Sha256: 15915619fef8bb098c46d07a4269370ba0650894607affb2120211dca9fa426c

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

module ProMotion
  module ScreenElements
    include ProMotion::ViewHelper
    
    def add(v, attrs = {})
      if attrs && attrs.length > 0
        set_attributes(v, attrs)
      end
      self.view.addSubview(v)
      v
    end
    alias :add_element :add
    alias :add_view :add

    def remove(v)
      v.removeFromSuperview
      v = nil
    end
    alias :remove_element :remove
    alias :remove_view :remove

    def bounds
      return self.view.bounds
    end
    
    def frame
      return self.view.frame
    end

    def content_height(view)
      height = 0
      view.subviews.each do |subview|
        next if subview.isHidden
        y = subview.frame.origin.y
        h = subview.frame.size.height
        if (y + h) > height
          height = y + h
        end
      end
      height
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ProMotion-0.5.0 lib/ProMotion/screen_helpers/screen_elements.rb