How can I load a View from Nib file into DetailView for an iPad on a button cli开发者_Python百科ck and back to previous view on another button click present in child view.
I found this site useful:
http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009775
The following code should steer you in the right direction.
To load a new ViewController:
- (IBAction)myBtnPushed{
NSLog(@"myBtnPushed");
NewRightVC *newRightVC = [[NewRightVC alloc] initWithNibName:@"NewRightVC" bundle:[NSBundle mainBundle]];
[detailViewController.navigationController pushViewController:newRightVC animated:YES];
NewLeftVC *newLeftVC = [[NewLeftVC alloc] initWithNibName:@"NewLeftVC" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:newLeftVC animated:YES];
}
To go back to the RootViewController and DefaultViewController in a UISplitViewController:
[detailViewController.navigationController popViewControllerAnimated:YES];
[self.navigationController popViewControllerAnimated:YES];
Example Project to examine can be downloaded here.
Example obtained from this post: https://stackoverflow.com/questions/5263128/splitviewcontroller-with-two-navigationcontroller-linking-protocols
精彩评论