简体   繁体   English

从支持方向切换回不支持的原型视图时,iOS6自动旋转

[英]iOS6 Autorotation when switching back from support orientation to not supported orentation view

As every iOS developer is now a days sturggling with autorotationg features changed with iOS6 launching with concerned to that i have one problem: 因为每个iOS开发人员现在都在使用iOS6启动时自动转换功能发生了变化,因为我有一个问题:

As my application supports UIInterfaceOrientationMaskPortrait but for few view controllers i want to support all UIInterfaceOrientationMaskPortraitAll i implemented it as following : 由于我的应用程序支持UIInterfaceOrientationMaskPortrait但对于少数视图控制器,我想支持所有UIInterfaceOrientationMaskPortraitAll我实现它如下:

in my rootviewcontrller that is in my case navigation contrller : 在我的rootviewcontrller中,在我的案例中导航控制器:

- (BOOL)shouldAutorotate
{
    return self.topViewController.shouldAutorotate; //you are asking your current controller what it should do
}

in my viewcontrllers : 在我的观点中:

-(BOOL)shouldAutorotate
{
    return //if view supports auto orientation then return yes else no
}

all is working well but 1 problem is... suppose my 2nd view supports all orientations and 1st view only supports only portrait then if I rotate 2 view and get back if i my current view orientation(view2) is landscape then view1 will also not rotate to its supported orientation. 一切都运行良好,但1问题是...假设我的第二个视图支持所有方向,第一个视图只支持肖像然后如果我旋转2视图然后回来,如果我当前的视图方向(view2)是风景,那么view1也不会旋转到其支持的方向。

so how to overcome from this problem please if any then solutions are welcome. 所以,如果有任何解决方案,欢迎解决这个问题。

Try to reset your view orientation in viewDidLoad method. 尝试在viewDidLoad方法中重置视图方向。 Solved it in my case. 解决了我的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM