美文网首页iOS技术交流收藏iOS自我学习库
iOS 在一个view中push到下一个控制器

iOS 在一个view中push到下一个控制器

作者: 苏坡乔 | 来源:发表于2016-03-02 16:36 被阅读1317次

在自定义的view中有点击事件需要push到下一个控制器,但是在view中不能用下面这个方法

[self.navigationController pushViewController:nextVc animated:YES];

正确的push姿势是这样的

//取出根视图控制器
UITabBarController *tabBarVc = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
//取出当前选中的导航控制器
UINavigationController *Nav = [tabBarVc selectedViewController];
[Nav pushViewController:nextVc animated:YES];

相关文章

网友评论

    本文标题:iOS 在一个view中push到下一个控制器

    本文链接:https://www.haomeiwen.com/subject/idunkttx.html