Sha256: e3427fb6fa8c788e289202a2ef3cc4b7c3223d4b837284f5f6101aaad9eb873b

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

module ProMotion
  module ScreenElements
    include ProMotion::ViewHelper

    def add(element, attrs = {})
      add_to self.view, element, attrs
    end
    alias :add_element :add
    alias :add_view :add

    def remove(element)
      element.removeFromSuperview
      element = nil
    end
    alias :remove_element :remove
    alias :remove_view :remove
    
    def add_to(parent_element, element, attrs = {})
      if attrs && attrs.length > 0
        set_attributes(element, attrs)
        set_easy_attributes(parent_element, element, attrs)
      end
      parent_element.addSubview element
      element
    end

    def bounds
      return self.view.bounds
    end

    def frame
      return self.view.frame
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ProMotion-0.6.5 lib/ProMotion/screen_helpers/screen_elements.rb
ProMotion-0.6.4 lib/ProMotion/screen_helpers/screen_elements.rb
ProMotion-0.6.3 lib/ProMotion/screen_helpers/screen_elements.rb
ProMotion-0.6.2 lib/ProMotion/screen_helpers/screen_elements.rb
ProMotion-0.6.1 lib/ProMotion/screen_helpers/screen_elements.rb
ProMotion-0.6.0 lib/ProMotion/screen_helpers/screen_elements.rb