I am following this example: http://doronkatz.com/ipad-programming-tutorial-hello-world. This example works great.
Now i want 3 tabs in the splitview and for each tab a new navigationcontroller. But i don't know how to implement it. I go to this code:
- (void)setDetailItem:(id)newDetailItem {
if (detailItem != newDetailItem) {
[detailItem release];
detailItem = [newDetailItem retain];
// Update the view.
navigationBar.topItem.title = detailItem;
if ([detailItem isEqualToString:@"Test"]) {
TestViewController *testViewController = [[TestViewController alloc] initWithNibName:@"TestView" bundle:nil];
[self.navigationController pushViewController:testViewController animated:NO];
[mapViewController release];
}
if ([detailItem isEqualToString:@"Test2"]) {
}
}
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}
But i know that i actually don't have to use 'pushviewcontroller', i just want a new navigationcontroller starting from that point, and so for each tab in the splitview. How can i accomplish this? I know it's really basic, but i cant figure it out.
Thanks.
As I understand your requirement, you want a split view controller as the main controller. The left panel will select an item and the right detail view for that item will contain 3 tabs. Each tab will have a navigation controller. The app store follows a pattern similar to the detail view.
Its important to structure your controllers as a tree.
With this pattern you can create the controller structure on viewDidLoad, but then change the contents of page 1, 2, 3 when responding to setDetailItem UINavigatorContoller has a popToRootViewControllerAnimated message that can reset the previous navigation controller stack for each of the 3 navigation controllers. When I started learning ios development, I found setting up the controller hierarchies in code easier than using interface builder. IB is faster once you get the concepts. You can still create an IB nib controller for page1,2,3 root view controllers.
good reference: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With