Module: UnderOs::UI::Manipulation
- Included in:
- View
- Defined in:
- lib/under_os/ui/utils/manipulation.rb
Overview
The ui-views manipulation functionality
Instance Method Summary collapse
- #append(*views) ⇒ Object
- #clear ⇒ Object
- #insert(view, position = :end) ⇒ Object
- #insertTo(view, position = nil) ⇒ Object
- #prepend(*views) ⇒ Object
- #remove ⇒ Object
Instance Method Details
#append(*views) ⇒ Object
20 21 22 23 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 20 def append(*views) views.each{|v| insert(v)} self end |
#clear ⇒ Object
40 41 42 43 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 40 def clear children.each(&:remove) self end |
#insert(view, position = :end) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 6 def insert(view, position=:end) if view.is_a?(Array) view.each{|v| insert(v, position)} else if position == :top @_.insertSubview(view._, atIndex: 0) else @_.addSubview(view._) end end self end |
#insertTo(view, position = nil) ⇒ Object
30 31 32 33 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 30 def insertTo(view, position=nil) view.insert(self, position) self end |
#prepend(*views) ⇒ Object
25 26 27 28 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 25 def prepend(*views) views.each{|v| insert(v, :top) } self end |
#remove ⇒ Object
35 36 37 38 |
# File 'lib/under_os/ui/utils/manipulation.rb', line 35 def remove @_.removeFromSuperview self end |