Sha256: 8bb6b84a3e58423648ca5543352e428f4f209215a63a0cf75c43f5029f948f33

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

module MotionPrime
  class PageViewControllerElement < BaseElement
    def view_class
      "UIPageViewController"
    end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motion-prime-1.0.2 motion-prime/elements/page_view_controller.rb
motion-prime-1.0.1 motion-prime/elements/page_view_controller.rb