ios pushViewController 页面不跳转问题解决
2017-07-18 17:58
661 查看
挺长时间没写iOS代码了,今天在写页面跳转的时候发现跳转不了,代码是这样的:
这是因为我们默认采用的mainstory启动,当换了viewcontroller启动时,navigationController为空。
所以需要在AppDelegate.m启动中添加:
self.view.backgroundColor = [UIColor whiteColor];
这样就OK了。。
-(void)pushClick:(UIButton*)sender{ SecondViewController *secondVC = [[SecondViewController alloc]init]; secondVC.labelString = _textLabel.text; [self.navigationController pushViewController:secondVC animated:YES]; }
这是因为我们默认采用的mainstory启动,当换了viewcontroller启动时,navigationController为空。
所以需要在AppDelegate.m启动中添加:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { FirstViewController *fc = [[FirstViewController alloc]init]; UINavigationController *navCtrlr = [[UINavigationController alloc]initWithRootViewController:fc]; [self.window setRootViewController:navCtrlr]; //navCtrlr.navigationBarHidden = YES; return YES; }这样页面就能跳转了,但是问题是页面都是黑的啊,解决方案是
self.view.backgroundColor = [UIColor whiteColor];
这样就OK了。。
相关文章推荐
- IOS-44-解决用模态方式presentViewController推出页面时导航栏消失问题
- IOS——使用PresentViewController推送页面,各页面间跳转及遇到的问题
- ios wkwebview 跳转到新的controllerview加载页面 出现闪退问题
- ios ViewController 页面跳转
- ios ViewController 页面跳转
- ios ViewController 页面跳转
- 浅论ViewController的加载 -- 解决 viewDidLoad 被提前加载的问题(pushViewController 前执行)
- ios ViewController 页面跳转
- iOS 关于presentViewController弹出页面反应迟钝的问题
- ios ViewController 页面跳转
- 解决presentViewController的延迟跳转问题
- IOS UINavigationController的下级页面(子页面)更改titleView不显示的问题
- NSNotification解决view和controller之间的跳转耦合问题
- iOS 关于presentViewController弹出页面反应迟钝的问题
- ios ViewController 页面跳转
- ios ViewController 页面跳转
- ios ViewController 页面跳转
- present 一个页面后 使用pushviewcontroller的问题
- ios ViewController 页面跳转
- 页面跳转问题presentViewController