Sha256: b27d2b1e34f739d93474b4e52bbd5c313c502e9e6c63480a4e0f772a209316ba

Contents?: true

Size: 875 Bytes

Versions: 9

Compression:

Stored size: 875 Bytes

Contents

module ProMotion
  class SplitViewController < UISplitViewController
    def master_screen
      s = self.viewControllers.first
      s.respond_to?(:visibleViewController) ? s.visibleViewController : s
    end
    
    def detail_screen
      s = self.viewControllers.last
      s.respond_to?(:visibleViewController) ? s.visibleViewController : s
    end
    
    def master_screen=(s)
      self.viewControllers = [ (s.navigationController || s), self.viewControllers.last]
    end
    
    def detail_screen=(s)
      # set the button from the old detail screen to the new one
      button = detail_screen.navigationItem.leftBarButtonItem
      s.navigationItem.leftBarButtonItem = button

      self.viewControllers = [self.viewControllers.first, (s.navigationController || s)]
    end
    
    def screens=(s_array)
      self.viewControllers = s_array
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ProMotion-1.1.2 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.1.1 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.1.0 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.1.0.rc1 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.0.4 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.0.3 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.0.2 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.0.1 lib/ProMotion/cocoatouch/split_view_controller.rb
ProMotion-1.0.0 lib/ProMotion/cocoatouch/split_view_controller.rb