IOS-Navigation的添加(RootViewController)
添加Nav方法:
在AppDelegate中
.h文件
@property (strong, nonatomic) UINavigationController *navC;
.m文件
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
添加方法2种如下:
1 、self.navC = [[[UINavigationControlleralloc] init] autorelease];
[self.navCpushViewController:self.viewControlleranimated:YES];
self.window.rootViewController = self.navC;
2、会有提示信息:
Application windows are expected to have a root view controller at the end of application launch
程序运行正常,尚未知道有何影响。
self.navC = [[UINavigationControlleralloc] initWithRootViewController:self.viewController];
[self.windowaddSubview:self.navC.view];
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步