Class: MotionPrime::PageViewControllerElement

Inherits:
BaseElement
  • Object
show all
Defined in:
motion-prime/elements/page_view_controller.rb

Instance Attribute Summary

Attributes inherited from BaseElement

#name, #options, #screen, #section, #styles, #view, #view_name

Instance Method Summary collapse

Methods inherited from BaseElement

#add_target, after_render, before_render, #bind_gesture, #cell_element?, #cell_section?, #compute_options!, #computed_options, #dealloc, factory, #hide, #initialize, #reload!, #render, #rerender!, #show, #update, #update_options, #update_with_options

Methods included from HasClassFactory

#camelize_factory, #class_factory, #low_camelize_factory, #underscore_factory

Methods included from HasStyleChainBuilder

#build_styles_chain

Methods included from HasNormalizer

#debug_info, #element?, #normalize_object, #normalize_options, #normalize_value

Constructor Details

This class inherits a constructor from MotionPrime::BaseElement

Instance Method Details

#render!(options = {}, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'motion-prime/elements/page_view_controller.rb', line 7

def render!(options = {}, &block)
  builder = ViewBuilder.new(class_factory(view_class),  computed_options.merge(options))
  controller = builder.view
  ViewStyler.new(controller, CGRectZero, builder.options).apply

  first = section.collection_delegate.fetch_item(0)
  controller.setViewControllers([first], direction:UIPageViewControllerNavigationDirectionForward,
                                animated:false, completion:lambda{|a|}) # completion:nil blows up!

  screen.addChildViewController(controller)
  screen.view.addSubview(controller.view)
  controller.didMoveToParentViewController(screen)
  screen.view.gestureRecognizers = controller.gestureRecognizers
  self.view = controller
end

#view_classObject



3
4
5
# File 'motion-prime/elements/page_view_controller.rb', line 3

def view_class
  "UIPageViewController"
end