mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-06-04 19:45:35 +08:00
any split code now in ProMotion instead of the App
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
class SplitViewController < UISplitViewController
|
||||
|
||||
attr_accessor :bbi, :pc
|
||||
|
||||
def main_controller
|
||||
self
|
||||
end
|
||||
|
||||
@@ -19,6 +19,20 @@ module ProMotion
|
||||
elsif args[:in_tab] && self.tab_bar
|
||||
present_view_controller_in_tab_bar_controller screen, args[:in_tab]
|
||||
|
||||
elsif self.split_screen
|
||||
puts [:split_screen_open, screen.is_modal?].inspect
|
||||
self.split_screen.bbi||=nil
|
||||
#-set split-menu button when needed
|
||||
screen.navigationItem.setLeftBarButtonItem(self.split_screen.bbi) if self.split_screen.bbi and !screen.is_modal?
|
||||
#-set split screen for new screen
|
||||
screen.split_screen=self.split_screen
|
||||
screen.detail_split_screen=true
|
||||
self.split_screen.delegate=screen
|
||||
s=screen
|
||||
s=screen.main_controller if screen.respond_to?(:main_controller)
|
||||
a=[self.split_screen.viewControllers[0], s]
|
||||
self.split_screen.viewControllers=a
|
||||
|
||||
elsif self.navigation_controller
|
||||
push_view_controller screen
|
||||
|
||||
@@ -97,6 +111,7 @@ module ProMotion
|
||||
screen.parent_screen = self if screen.respond_to?("parent_screen=")
|
||||
screen.title = args[:title] if args[:title] && screen.respond_to?("title=")
|
||||
screen.modal = args[:modal] if args[:modal] && screen.respond_to?("modal=")
|
||||
puts [:screen_modal, screen.modal].inspect
|
||||
|
||||
# Hide bottom bar?
|
||||
screen.hidesBottomBarWhenPushed = args[:hide_tab_bar] == true
|
||||
|
||||
@@ -43,8 +43,11 @@ module ProMotion
|
||||
return
|
||||
end
|
||||
split = SplitViewController.alloc.init
|
||||
split.delegate=args[:screen2]
|
||||
args[:screen1].split_screen=split
|
||||
args[:screen1].detail_split_screen=false
|
||||
args[:screen2].split_screen=split
|
||||
args[:screen2].detail_split_screen=true
|
||||
split.delegate=args[:screen2]
|
||||
split.tabBarItem=create_tab_bar_icon_custom(args[:title], args[:icon], 0)
|
||||
scr=[]
|
||||
[args[:screen1], args[:screen2]].each do |s|
|
||||
|
||||
@@ -5,7 +5,8 @@ module ProMotion
|
||||
include ProMotion::SystemHelper
|
||||
include ProMotion::ScreenTabs
|
||||
|
||||
attr_accessor :parent_screen, :first_screen, :tab_bar_item, :tab_bar, :modal, :split_screen
|
||||
attr_accessor :parent_screen, :first_screen, :tab_bar_item, :tab_bar, :modal
|
||||
attr_accessor :split_screen, :detail_split_screen
|
||||
|
||||
def on_create(args = {})
|
||||
unless self.is_a?(UIViewController)
|
||||
@@ -30,9 +31,20 @@ module ProMotion
|
||||
self.split_screen.nil? != true
|
||||
end
|
||||
|
||||
def open_in_split_screen(screen)
|
||||
a=[self.split_screen.viewControllers[0], screen.main_controller]
|
||||
self.split_screen.viewControllers=a
|
||||
def splitViewController(svc, willHideViewController:vc, withBarButtonItem:bbi, forPopoverController:pc)
|
||||
puts [:splitViewController_hide, self.class, self.detail_split_screen, svc, vc, bbi, pc].inspect
|
||||
bbi.title="Menu"
|
||||
self.split_screen.bbi=bbi
|
||||
self.navigationItem.setLeftBarButtonItem(bbi)
|
||||
self.split_screen.pc=pc
|
||||
self.popoverViewController = pc
|
||||
end
|
||||
|
||||
def splitViewController(svc, willShowViewController:vc, invalidatingBarButtonItem:bbi)
|
||||
puts [:splitViewController_show, self.detail_split_screen, svc, vc, bbi].inspect
|
||||
self.split_screen.bbi=nil
|
||||
self.split_screen.pc=nil
|
||||
self.navigationItem.setLeftBarButtonItems([], animated:false)
|
||||
end
|
||||
|
||||
def has_nav_bar?
|
||||
|
||||
Reference in New Issue
Block a user