简体   繁体   English

iPhone动态更改rootviewcontroller?

[英]iPhone changing the rootviewcontroller dynamically?

I will use UINAvigationController in my app, but noticed that my rootview should be either a tableview or a uiview depending on content I received.我将在我的应用程序中使用 UINAvigationController,但注意到我的 rootview 应该是 tableview 或 uiview,具体取决于我收到的内容。 as you know It comes with a tableview by default.如您所知,它默认带有一个表格视图。 how can I push my first view dynmacally here?我怎样才能在这里动态地推送我的第一个视图?

U can do like this in application:didFinishLaunchingWith.... in app delegate.你可以在应用程序中这样做:didFinishLaunchingWith.... 在应用程序委托中。 For this, u need to create the application with window based application template.为此,您需要使用基于 window 的应用程序模板创建应用程序。

DetailViewController *detailView = [[DetailViewController alloc] initWithNibnam..];
UINavigationController *uiNavController = [[UINavigationController alloc] initWithRootViewController:detailView];
self.window.rootViewController = uiNavController;
[detailView release]; 
[uiNavController release];

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

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