mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-06-04 19:45:35 +08:00
Added support for toolbar hiding/showing in UINavigationController
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user