module ProMotion::SplitScreen
Public Instance Methods
create_split_screen(master, detail, args={})
click to toggle source
# File lib/ProMotion/ipad/split_screen.rb, line 9 def create_split_screen(master, detail, args={}) master = master.new if master.respond_to?(:new) detail = detail.new if detail.respond_to?(:new) split = split_screen_controller(master, detail) split_screen_setup(split, args) split end
open_split_screen(master, detail, args={})
click to toggle source
# File lib/ProMotion/ipad/split_screen.rb, line 3 def open_split_screen(master, detail, args={}) split = create_split_screen(master, detail, args) open split, args split end
splitViewController(svc, willHideViewController: vc, withBarButtonItem: button, forPopoverController: _)
click to toggle source
iOS 7 and below
# File lib/ProMotion/ipad/split_screen.rb, line 20 def splitViewController(svc, willHideViewController: vc, withBarButtonItem: button, forPopoverController: _) button ||= self.displayModeButtonItem if self.respond_to?(:displayModeButtonItem) return unless button button.title = @pm_split_screen_button_title || vc.title svc.detail_screen.navigationItem.leftBarButtonItem = button end
Private Instance Methods
split_screen_controller(master, detail)
click to toggle source
# File lib/ProMotion/ipad/split_screen.rb, line 50 def split_screen_controller(master, detail) split = SplitViewController.alloc.init split.viewControllers = [ (master.navigationController || master), (detail.navigationController || detail) ] split.delegate = self [ master, detail ].map { |s| s.split_screen = split if s.respond_to?(:split_screen=) } split end
split_screen_setup(split, args)
click to toggle source
# File lib/ProMotion/ipad/split_screen.rb, line 60 def split_screen_setup(split, args) if (args[:item] || args[:title]) && respond_to?(:create_tab_bar_item) split.tabBarItem = create_tab_bar_item(args) end @pm_split_screen_button_title = args[:button_title] if args.has_key?(:button_title) split.presentsWithGesture = args[:swipe] if args.has_key?(:swipe) end