Sha256: 2517a28ad58ef5d2e4752973358c51f92c4f45dbdd3b3eddaed51358b0689c8a

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

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

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

    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

2 entries across 2 versions & 1 rubygems

Version Path
ProMotion-0.4.1 lib/ProMotion/_screen_modules/screen_elements.rb
ProMotion-0.4.0 lib/ProMotion/_screen_modules/screen_elements.rb