如何在viewcontroller上添加一个UINavigationController
1个回答
展开全部
通过appDelegate,也不用IB的方式,用代码来实现,为一个ViewController添加一个NavigationController,并且声明一下他的rootViewcontroller
<pre class="brush:objc; toolbar: true; auto-links: false;">
GroupsController *groupsController = [[[GroupsController alloc] initWithNibName:nil bundle:nil] autorelease];
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:groupsController];
[myViewController presentModalViewController: navigationController];
</pre>
<pre class="brush:objc; toolbar: true; auto-links: false;">
GroupsController *groupsController = [[[GroupsController alloc] initWithNibName:nil bundle:nil] autorelease];
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:groupsController];
[myViewController presentModalViewController: navigationController];
</pre>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询