Reputation: 34818
What would the code be to make use of a UINavigationController in the following circumstance?
So I'm not actually sure where/how to create/hold/use the UINavigationController in this case? What would the code look like here, where would the UINavigationController variable be held, would the FlipSideView XIB need to be modified?
PS. In fact would the FlipSideview itself have to change to incorporate a navigation bar at the top? (then I'd have to mode the existing template's DONE button from it's nav bar, to the new UINavigationController nav bar I guess)
PSS. Trying this but get an error:
- (void)viewDidLoad
{
[super viewDidLoad];
self.uiNavController = [[UINavigationController alloc] initWithRootViewController:self];
self.navigationController = self.uiNavController;
// ==> error: object cannot be set - either readonly property or no setter found
}
Upvotes: 1
Views: 306
Reputation: 17478
for this, your FlipSideViewController itself should implement UINavigationControllerDelegate.
How are showing that FlipSideView?
FlipSideViewController *flipSideView = [[FlipSideViewController alloc] init..];
[self presentModalViewController:flipSideView animated:YES];
[flipSodeView release];
Like this????
Then u have u to change it to
FlipSideViewController *flipSideView = [[FlipSideViewController alloc] init..];
UINavigationController *uiNavController = [[UINavigationController alloc] initWithRootViewController:flipSideView];
[self presentModalViewController:uiNavController animated:YES];
[flipSideView release];
[uiNavController release];
Upvotes: 1
Reputation: 1803
UINavigationControllers are designed to be the ROOT view controller of your heirarchy.
So in your example, you should have the FlipSideViewController hold a UINavigationController with the NavigationBar hidden. Then you can PUSH your TableViewController onto the stack as the 'root' view.
When a user taps a cell in your tableview, you can instantiate a new view & PUSH it onto the self.navigationController's stack. Ensure you add code to the new view's viewWillAppear method to show the navigationBar & code to the viewDidDisappear to hide the navigationBar again.
Upvotes: 1