Module: ProMotion::ScreenElements

Includes:
ViewHelper
Included in:
ScreenModule
Defined in:
lib/ProMotion/screen_helpers/screen_elements.rb

Instance Method Summary collapse

Methods included from ViewHelper

#content_height, #frame_from_array, #objective_c_method_name, #set_attribute, #set_attributes, #set_easy_attributes

Instance Method Details

#add(element, attrs = {}) ⇒ Object Also known as: add_element, add_view



5
6
7
# File 'lib/ProMotion/screen_helpers/screen_elements.rb', line 5

def add(element, attrs = {})
  add_to self.view, element, attrs
end

#add_to(parent_element, element, attrs = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/ProMotion/screen_helpers/screen_elements.rb', line 18

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

#boundsObject



27
28
29
# File 'lib/ProMotion/screen_helpers/screen_elements.rb', line 27

def bounds
  return self.view.bounds
end

#frameObject



31
32
33
# File 'lib/ProMotion/screen_helpers/screen_elements.rb', line 31

def frame
  return self.view.frame
end

#remove(element) ⇒ Object Also known as: remove_element, remove_view



11
12
13
14
# File 'lib/ProMotion/screen_helpers/screen_elements.rb', line 11

def remove(element)
  element.removeFromSuperview
  element = nil
end