在UINavigationController中使用UITabBarController,处理Two-stage Rotation错误
来源:互联网 发布:网页ui界面设计软件 编辑:程序博客网 时间:2024/05/16 04:26
写iOS应用时,经常需要将UITabBarController嵌入到一个根UINavigationController中,如果处理不好,我们会遇到这样的错误:
Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation.
网上找了一下,StackOverFlow的这个答案说,不应该将UITabBarControllier嵌入到UINavigationController中作为rootViewController,但是,我们的确想要这样做,所以只好寻找其它办法。不过,至少我们可以确定的是,问题出在rootViewController同时包含UITabBarController和UINavigationController。
几经尝试,最后发现,在设置为window.rootViewController
之前,先指定tabBarController.selectedIndex = 0
,问题解决。
可以得出,出现上述错误,是因为XCode不知道你需要push哪个子viewController,在加载navigationController的时候,不知道要载入哪一个controller,于是无脑的将tabBarController的viewControllers都动画载入了。
完整代码如下:
StoryBoard:
运行效果:
原文作者: lslin
原文链接: http://blog.lessfun.com/blog/2014/01/15/using-uitabbarcontroller-inside-uinavigationcontroller/
版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0
0 0
- 在UINavigationController中使用UITabBarController,处理Two-stage Rotation错误
- 在UINavigationController 中增加 UITabBarController 然后设置navigatio
- UItabBarController和UINavigationController结合使用
- UITabBarController与UINavigationController配合使用
- UINavigationController与UITabBarController混合使用
- UITabBarController与UINavigationController配合使用
- UITabBarController与UINavigationController配合使用
- UITabBarController与UINavigationController配合使用
- UITabBarController和UINavigationController搭配使用
- 在presentModalViewController中使用UINavigationController
- 在presentModalViewController中使用UINavigationController
- Two-stage rotation animation is deprecated. This application should use the smoother single-stage an
- Two-stage rotation animation is deprecated. This application should use the smoother single-stage an
- Two-stage rotation animation is deprecated. This application should use the smoother single-stage an
- UINavigationController,UITabBarController
- UINavigationController, UITabBarController
- UINavigationController+UITabBarController
- UINavigationController、UITabBarController
- 库克遭打脸!顶级零售商不接受苹果支付
- SAT数学复习计划
- spingmvc访问静态页面
- pod 一些解释
- github生成个公钥
- 在UINavigationController中使用UITabBarController,处理Two-stage Rotation错误
- BeagleBone Black Linux驱动程序开发入门(1): LED驱动程序
- oracle数据库知识
- 二,mogodb索引
- Sql server2012中触发器发送http请求
- JQuery实战---窗口效果
- 再谈 共轭方向法/Conjugate Direction Method In Optimization
- APi 网络学习之一SNMP(简单网络管理协议)
- SSL协议详解