开发者

How to setup UISplitView with a navigation controller in the detail view

开发者 https://www.devze.com 2023-01-02 03:24 出处:网络
So just went through this tutorial: http://icodeblog.com/2010/04/05/ipad-programming-tutorial-hello-world/

So just went through this tutorial:

http://icodeblog.com/2010/04/05/ipad-programming-tutorial-hello-world/

Now what I want to do is setup the detail view as a navigation controller. The question is how?

My first inclination is to have the DetailViewController extend a UINavigationContoller. Is that the best approach? If so does the ar开发者_Python百科ray of controllers go into the DetailViewController?

Comments, ideas, tutorials are all welcome. Thank you.


Yes, chaitanya is right; You can add navigation controller to split view from xib or you can create split view programmitically, like:

self.rootViewController=[[RootViewController alloc]init];
    self.detailViewController=[[FirstDetailViewController alloc]init];


UINavigationController *rootNav=[[UINavigationController alloc]initWithRootViewController:rootViewController];
UINavigationController *detailNav=[[UINavigationController alloc]initWithRootViewController:detailViewController];

self.splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailNav,nil];
self.splitViewController.delegate=self.detailViewController;

so now your will have navigation controller in detail view.

You can download the working code here.


The solution:

http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/


the better approach would be adding a navigation controller for the detail view in interface nib just like how we will add for root view contrller.

0

精彩评论

暂无评论...
验证码 换一张
取 消