Sounds easy, except you need to define the toolbar separately for each UIViewController while navigating deeper into lists. That should be easier, right? Try this:
MyViewController *myVC = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil];The good news is that now each view does have the same toolbar - with just one line of code!
myVC.toolbarItems = self.toolbarItems;
[self.navigationController pushViewController:myVC animated:YES];
[myVC release];
The bad news is that it really is the same toolbar, including action callbacks. For truly global action like "Open Settings" it's fine, but for view specific action like "Search This Sublist" you need to figure out some way to forward the action from initial callback location to current viewController. This could be done e.g. via notifications:
[[NSNotificationCenter defaultCenter]You have to choose between a) creating separate toolbar for each viewController or 2) handling all callbacks in one place and possibly forwarding them to currently active view.
postNotificationName:MyRefreshNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(myRefreshCallback)
name:MyRefreshNotification
object:nil];
No comments:
Post a Comment