我想知道,我们如何在UINavigationController中设置UIViewController而不使用UITableView到其根视图控制器。有关于此的任何帮助?提前致谢。如何将UIVIewController设置为RootViewController?
1
A
回答
-3
的UINavigationController pushViewController:动画:
8
你能做到这一点,如下所示:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...
UIViewController *myViewController = [[UIViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];
self.window.rootViewController = navigationController;
// ...
}
可以更换类的myViewController
和/或使用笔尖如果你想进行初始化。
1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:[[OptionViewController alloc]initWithNibName:@"OptionViewController" bundle:nil]];
self.window.rootViewController=nav;
self.window.backgroundColor = [UIColor grayColor];
[self.window makeKeyAndVisible];
return YES;
}
0
它的工作对我来说:
设置你的窗口tabviewcontroller,那么它会正常工作。
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UITabBarController *tabVC = [self.storyboard instantiateViewControllerWithIdentifier:@"MyMainView"];
[window setRootViewController:tabVC];
相关问题
- 1. 当父UIViewController设置为RootViewController时,UIView不会成为First Responder
- 2. 如何在swift中从我的UIViewController设置rootViewController?
- 3. 如何获取/设置rootViewController?
- 4. Monotouch:UINavigationController,设置RootViewController
- 5. 如何将RootViewController设置为SplitViewController中的分组表格
- 6. 如何动画设置rootViewController窗口
- 7. IOS uiviewcontroller:如果rootviewcontroller设置为一个新的viewcontroller将视图控制器是免费的
- 8. 为ipad 3.2设置rootViewController不起作用
- 9. 将RootViewController分配给UIViewController会发出警告 - 为什么?
- 10. Swift:设置rootViewController不工作?
- 11. 如何在UIViewController中设置视图
- 12. 如何在UIViewController中设置parentViewController?
- 13. iPhone:如何设置UIViewController框架?
- 14. 股票UIViewController不能设置为IBOutlet?
- 15. Swift在AppDelegate中设置rootViewController延迟
- 16. 设置UIWindow的rootViewController是做什么的?
- 17. 如何设置rootViewController指向指针的地址
- 18. Xcode如何通过故事板隐式设置rootViewController?
- 19. 将UITabBarDelegate设置为UIViewController时,应用程序崩溃
- 20. 在其他UIViewController中将UIViewControllers设置为属性
- 21. UIViewController&UITableViewController - 设置页面
- 22. 如何从NavigationController将值推送到rootViewController?
- 23. 如何将rootViewController更改为尚未加载的VC?
- 24. 如何将RootViewController更改为另一个XIB?
- 25. 如何在普通的UIViewController之后设置一个自定义的UIViewController?
- 26. 如何将logrus时间设置为UTC
- 27. StAX - 如何将XMLInputFactory.IS_VALIDATING设置为true?
- 28. 如何将位列设置为空?
- 29. 如何将超时设置为JSONP?
- 30. 如何将dojox.mobile.View设置为高度100%