Added support for toolbar hiding/showing in UINavigationController

This commit is contained in:
Steve Ross
2013-05-16 15:39:35 -07:00
parent e0b0f7329b
commit 92bfb2c3e2
3 changed files with 24 additions and 0 deletions

View File

@@ -123,6 +123,11 @@ class AppDelegate < ProMotion::Delegate
end
```
Note: You can use other keysin `on_load` when you open a new screen:
* `modal: ` [`true` | `false`]
* `toolbar:` [`true` | `false`]
Make sure you remove the `didFinishLoadingWithOptions` method or call `super` in it. Otherwise
ProMotion won't get set up and `on_load` won't be called.

View File

@@ -18,6 +18,7 @@ module ProMotion
end
self.add_nav_bar if args[:nav_bar]
self.navigationController.toolbarHidden = !args[:toolbar] if args[:toolbar]
self.on_init if self.respond_to?(:on_init)
self.table_setup if self.respond_to?(:table_setup)
self

View File

@@ -159,3 +159,21 @@ describe "screen properties" do
end
end
describe "screen with toolbar" do
it "showing" do
# Simulate AppDelegate setup of main screen
screen = HomeScreen.new modal: true, nav_bar: true, toolbar: true
screen.on_load
screen.navigationController.toolbarHidden?.should == false
end
it "hidden" do
# Simulate AppDelegate setup of main screen
screen = HomeScreen.new modal: true, nav_bar: true, toolbar: false
screen.on_load
screen.navigationController.toolbarHidden?.should == true
end
end