如何消除“两阶段旋转”警告? [英] How to eliminate "two-stage rotation" warning?

查看:107
本文介绍了如何消除“两阶段旋转”警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的窗口的rootViewController是一个UINavigationController
然后..在这个导航控制器的rootViewController中,我弹出一个模态视图(一个UITabBarController)



这样的事情:

  UIWindow 
- > UINavigationController
- > MyFirstViewController< - 在这个课程中我运行以下代码



  [self.navigationController presentModalViewController:tabController animated:YES]; 

然后调试器警告:旋转多个视图控制器时不支持使用两阶段旋转动画或者查看控制器而不是窗口委托



但是,如果模态视图不是tabController,则不会出现此警告。



<当我在导航控制器中弹出tabController模态视图时,这种行为对应用程序有什么影响?



或者我应该找到另一种方法来做到这一点?



我在这个网站上发现了几个类似的问题,但是我没有得到它......

解决方案

原因是你在UITabBarController的预期用途之外使用它。它仅用作根控制器,如果您需要与tabbar使用工具栏类似的东西。大约半年前我遇到了确切的问题。不幸的是,如果你这样使用它,你也会遇到其他问题。



UITabBarController文档


因为UITabBarController类
继承自UIViewController
类,所以标签栏控制器具有他们的
自己的视图可以通过
view属性访问。部署
标签栏界面时,必须将此视图安装
作为窗口的根目录。
与其他视图控制器不同,选项卡
bar界面永远不应该是
作为另一个视图
控制器的子项安装。



My window's rootViewController is a UINavigationController Then.. In this navigation controller's rootViewController, I popup a modal view(a UITabBarController)

something like this:

UIWindow
->UINavigationController
-->MyFirstViewController<--In this class I run following code

[self.navigationController presentModalViewController:tabController animated:YES];

Then the debugger warning :Using two-stage rotation animation is not supported when rotating more than one view controller or view controllers not the window delegate

However, if the modal view is not tabController this warning does not appear.

What will this behavior do harm to the application when I popup tabController modal view in a navigation controller?

Or I should find another way to do this?

I found several similar questions on this site, but I don't get it...

解决方案

The reason is that you are using a UITabBarController outside of the intended usage of it. It is ONLY intended to be used as a root controller, and should you need something similiar to a tabbar use toolbar. I was running into trouble with the exact problem about a half year ago. You will also run into other problems if you use it like that, unfortunately.

UITabBarController documentation

Because the UITabBarController class inherits from the UIViewController class, tab bar controllers have their own view that is accessible through the view property. When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.

这篇关于如何消除“两阶段旋转”警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆