ios pushViewController 无效果
2016-08-04 20:25
369 查看
当我们第一次实现页面跳转时,发现使用
-(void)pushButtonPressed:(UIButton*)sender{
NSLog(@"dsfas");
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 {
// Override point for customization after application launch.
FirstViewController *fc = [[FirstViewController alloc]init];
UINavigationController *navCtrlr = [[UINavigationController alloc]initWithRootViewController:fc];
[self.window setRootViewController:navCtrlr];
navCtrlr.navigationBarHidden = YES;
return YES;
}
-(void)pushButtonPressed:(UIButton*)sender{
NSLog(@"dsfas");
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 {
// Override point for customization after application launch.
FirstViewController *fc = [[FirstViewController alloc]init];
UINavigationController *navCtrlr = [[UINavigationController alloc]initWithRootViewController:fc];
[self.window setRootViewController:navCtrlr];
navCtrlr.navigationBarHidden = YES;
return YES;
}
相关文章推荐
- IOS开动画效果之──实现 pushViewController 默认动画效果
- ios pushViewController 无效果
- IOS开动画效果之──实现 pushViewController 默认动画效果
- IOS开动画效果之──实现 pushViewController 默认动画效果
- iOS pushViewController 实现push 和pop 默认动画效果
- IOS开动画效果之──实现 pushViewController 默认动画效果(转)
- IOS开动画效果之──实现 pushViewController 默认动画效果
- iOS开发中的ViewController转场切换效果实现简介
- 为何pushViewController没有效果?
- 类似pushViewController的效果,但是是从底部弹出
- iOS7 pushViewController 动画效果卡顿
- 更改pushViewController和popViewController的动画效果
- iOS开发之presentViewController、presentModelViewController和pushViewController
- ios: push viewcontroller 时出现Presenting view controllers on detached view controllers is discouraged 警告
- 更改pushViewController和popViewController的动画效果
- 【iOS学习笔记 15-11-06】简单自定义navigationcontroller push和pop动画效果
- iOS开发 获取当前正在显示的ViewController(包含Push的和presented的)
- 更改pushViewController和popViewController的动画效果
- 更改pushViewController和popViewController的动画效果
- IOS之左右滑动效果的实现——利用PPRevealViewController