1 UIView 中的可能性纵向模式 [英] Possibility Portrait mode in 1 UIView

查看:31
本文介绍了1 UIView 中的可能性纵向模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能我可以通过编程方式说只有 1 个 UIView 可以处于横向模式?我的整个应用程序必须处于纵向模式(根本不移动),但 1 个 UIView 应该能够进入横向模式(为了更好地显示图片);

Is there a possibility that I can programatically say that only 1 UIView can be in landscape mode? My Whole app has to be in portrait mode (not moving at all) but 1 UIView should be able to go in Landscape mode (To show pictures even better);

推荐答案

你这样轮换 VC:

- (BOOL)shouldAutorotate {
     return self.topViewController.shouldAutorotate;    
}

- (NSUInteger)supportedInterfaceOrientations {
      return self.topViewController.supportedInterfaceOrientations;    
}

限制 VC 使其不会轮换:

Restrict VC so it won't rotate:

- (BOOL)shouldAutorotate { return NO; }

- (NSUInteger)supportedInterfaceOrientations {
    return (UIInterfaceOrientationMaskPortrait); 
}

您可以根据需要更改条件,此答案来自此 link 这样你就可以去那里了解更多.

You could change condition as per your need and this answer is referred from this link so you could go there for more understanding.

还要确保 iOS 6/7 有不同的检查方法.如果还有其他问题,请告诉我.

Also do keep that iOS 6/7 have different method for checking.If anything else then let me know.

更新:- 用于检查模式的 iOS 7 回调方法

UPDATED:- iOS 7 callBack method for checking mode

– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– didRotateFromInterfaceOrientation:

这篇关于1 UIView 中的可能性纵向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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