
一、设置工程中默认的ViewController为导航控制器,并加载Main.storyboard
1.在AppDelegate.m中设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; ViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:@"view"]; self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController:vc]; [self.window makeKeyAndVisible]; return YES; }
|
2.ViewController中弹出控制器方法
1
|
[self.navigationController pushViewController:liveVC animated:YES];
|
3.如果没有将ViewController设置为导航控制器只能使用以下方法弹出控制器
1
|
[self presentViewController:liveVC animated:YES completion:nil];
|
近期评论