Class: MotionKit::Layout
- Inherits:
-
TreeLayout
- Object
- BaseLayout
- TreeLayout
- MotionKit::Layout
- Defined in:
- lib/motion-kit-ios/helpers/uiview_helpers.rb,
lib/motion-kit-osx/helpers/nsview_helpers.rb,
lib/motion-kit-tvos/helpers/uiview_helpers.rb,
lib/motion-kit-ios/helpers/uiview_constraints_helpers.rb,
lib/motion-kit-osx/helpers/nsview_constraints_helpers.rb,
lib/motion-kit-tvos/helpers/uiview_constraints_helpers.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseLayout
Instance Method Summary collapse
- #add_child(subview, options = {}) ⇒ Object
-
#constraints(add_to_view = nil, &block) ⇒ Object
Ensure we always have a context in this method; makes it easier to define constraints in an ‘add_constraints` method.
-
#default_root ⇒ Object
platform specific default root view.
- #remove_child(subview) ⇒ Object
Methods inherited from TreeLayout
#add, #all, #all_views, #always, #build, #built?, #child_layouts, #create, #create_default_root_context, #first, #forget, #forget_tree, #forget_view, #get, #get_view, #initial, #initial?, #initialize, #last, #last_view, #name_element, #nearest, #next, #nth, #nth_view, #prev, #reapply, #reapply!, #reapply?, #reapply_blocks, #remove, #remove_view, #root, #run_reapply_blocks, view, #view
Methods inherited from BaseLayout
#add_deferred_block, #apply, #apply_with_context, #apply_with_target, #context, #deferred, #deferred_blocks, delegate_method_fix, #has_context?, #initialize, #ipad?, #iphone35?, #iphone47?, #iphone4?, #iphone55?, #iphone?, #is_parent_layout?, #method_missing, #objc_version, #orientation?, #orientation_block, #parent_layout, #retina?, #ruby_version, #run_deferred, #set_parent_layout, #target, #tv?, #v
Methods included from BaseLayoutClassMethods
#layout_for, #memoize, #target_klasses, #targets
Constructor Details
This class inherits a constructor from MotionKit::TreeLayout
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MotionKit::BaseLayout
Instance Method Details
#add_child(subview, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/motion-kit-ios/helpers/uiview_helpers.rb', line 14 def add_child(subview, ={}) if (sibling = [:behind]) target.insertSubview(subview, belowSubview: sibling) elsif (sibling = [:in_front_of]) target.insertSubview(subview, aboveSubview: sibling) elsif (z_index = [:z_index]) target.insertSubview(subview, atIndex: z_index) else target.addSubview(subview) end end |
#constraints(add_to_view = nil, &block) ⇒ Object
Ensure we always have a context in this method; makes it easier to define constraints in an ‘add_constraints` method.
25 26 27 28 29 30 31 32 33 |
# File 'lib/motion-kit-ios/helpers/uiview_constraints_helpers.rb', line 25 def constraints(add_to_view=nil, &block) if has_context? apply(:constraints, add_to_view, &block) else context(self.view) do constraints(add_to_view, &block) end end end |
#default_root ⇒ Object
platform specific default root view
8 9 10 11 12 |
# File 'lib/motion-kit-ios/helpers/uiview_helpers.rb', line 8 def default_root # child Layout classes will return *their* UIView subclass from self.targets view_class = self.class.targets || MotionKit.default_view_class view_class.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame) end |
#remove_child(subview) ⇒ Object
26 27 28 |
# File 'lib/motion-kit-ios/helpers/uiview_helpers.rb', line 26 def remove_child(subview) subview.removeFromSuperview end |