module UnderOs::UI::Manipulation

The ui-views manipulation functionality

Public Instance Methods

append(*views) click to toggle source
# File lib/under_os/ui/utils/manipulation.rb, line 20
def append(*views)
  views.each{|v| insert(v)}
  self
end
clear() click to toggle source
# File lib/under_os/ui/utils/manipulation.rb, line 40
def clear
  children.each(&:remove)
  self
end
insert(view, position=:end) click to toggle source
# 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) click to toggle source
# File lib/under_os/ui/utils/manipulation.rb, line 30
def insertTo(view, position=nil)
  view.insert(self, position)
  self
end
prepend(*views) click to toggle source
# File lib/under_os/ui/utils/manipulation.rb, line 25
def prepend(*views)
  views.each{|v| insert(v, :top) }
  self
end
remove() click to toggle source
# File lib/under_os/ui/utils/manipulation.rb, line 35
def remove
  @_.removeFromSuperview
  self
end