标签:
presentViewController:
- (void)publishClick{ NSLog(@"发布按钮被点击"); PublishViewController *publishVc = [[PublishViewController alloc]init];
// 包装创建导航控制器 MainNavigationController *nav = [[MainNavigationController alloc]initWithRootViewController:publishVc]; // 这里不能使用self来弹出其他控制器, 因为self执行了dismiss操作 UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController; [root presentViewController:nav animated:YES completion:nil]; }
pushViewController:
// 在视图中push,需要取到导航控制器
// 先取得TabBarViewController UITabBarController *tabBarVc = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
// 再取得导航控制器
// 以下一条语句:This may return the "More" navigation controller if it exists.
UINavigationController *nav = (UINavigationController *)tabBarVc.selectedViewController;
[nav pushViewController:webVc animated:YES];
视图push和presentViewController注意点
标签:
原文地址:http://www.cnblogs.com/pengsi/p/5728571.html