Fixes issue #57

Also cleans up the on_load for split screens.
This commit is contained in:
Jamon Holmgren
2013-05-08 11:37:23 -07:00
parent 9a4e110999
commit e2c5eb66c0
4 changed files with 11 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
module ProMotion
class Delegate
include ProMotion::ScreenTabs
include ProMotion::SplitScreen if NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].include?("2")
include ProMotion::SplitScreen if NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].include?("2") # Only with iPad
attr_accessor :window
def application(application, didFinishLaunchingWithOptions:launch_options)
@@ -11,8 +11,6 @@ module ProMotion
on_load(application, launch_options)
open_home_screen if has_home_screen && self.window.nil?
true
end

View File

@@ -81,6 +81,7 @@ module ProMotion
def push_view_controller(vc, nav_controller=nil)
Console.log(" You need a nav_bar if you are going to push #{vc.to_s} onto it.", withColor: Console::RED_COLOR) unless self.navigation_controller
nav_controller ||= self.navigation_controller
vc.first_screen = false if vc.respond_to?(:first_screen=)
nav_controller.pushViewController(vc, animated: true)
end

View File

@@ -8,6 +8,8 @@ module ProMotion
split.viewControllers = [ master_main, detail_main ]
split.delegate = self
[ master, detail ].map { |s| s.split_screen = split if s.respond_to?(:split_screen=) }
split
end
@@ -15,14 +17,9 @@ module ProMotion
master = master.new if master.respond_to?(:new)
detail = detail.new if detail.respond_to?(:new)
split = split_screen_controller(master, detail)
[ master, detail ].map { |s| s.on_load if s.respond_to?(:on_load) }
[master, detail].each do |s|
s.split_screen = split if s.respond_to?("split_screen=")
s.on_load if s.respond_to?(:on_load)
end
split
split_screen_controller master, detail
end
def open_split_screen(master, detail, args={})

View File

@@ -18,8 +18,8 @@ module ProMotion
end
self.add_nav_bar if args[:nav_bar]
self.table_setup if self.respond_to?(:table_setup)
self.on_init if self.respond_to?(:on_init)
self.table_setup if self.respond_to?(:table_setup)
self
end
@@ -55,8 +55,10 @@ module ProMotion
end
def add_nav_bar
self.navigation_controller = NavigationController.alloc.initWithRootViewController(self)
self.first_screen = true
self.navigation_controller ||= begin
self.first_screen = true if self.respond_to?(:first_screen=)
NavigationController.alloc.initWithRootViewController(self)
end
end
def set_nav_bar_right_button(title, args={})