简体   繁体   English

单独使用UINavigationViewController

[英]Using a UINavigationViewController on its own

在我的应用程序中,它基于一个tabbar视图控制器,每个tabbar项目有许多uinavigationviewcontrollers,我想在某个时候(在应用程序启动时)调用presentModalViewController,它包含一个uinavigationcontroller作为root,这样用户可以做一些事情......当他或她完成时,可以点击右上角的完成按钮以关闭模态视图控制器,然后返回到基本标签栏视图....如何使用Interface Builder?

In XCode, create a new View XIB file and open it in Interface Builder. 在XCode中,创建一个新的View XIB文件并在Interface Builder中打开它。 In this xib file, delete the View and drag a UINavigationController into it's place. 在这个xib文件中,删除View并将UINavigationController拖到它的位置。

Then, in your view controller code, something like 然后,在您的视图控制器代码中,类似于

UINavigationController *controller = [[UINavigationController alloc] initWithNibName:@"ModalViewController" bundle:nil];
[self presentModalViewController:controller animated:YES];
[controller release];

Will load your XIB and present it. 将加载您的XIB并呈现它。

Hope this helps, any other questions don't hesitate to comment on this answer! 希望这有帮助,任何其他问题都毫不犹豫地评论这个答案!

S 小号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM