[英]Set orientation landscape for a view controller
My app is a portrait app, now I want to put a view controller in landscape. 我的应用程序是人像应用程序,现在我想将视图控制器置于横向。 There's a easy way to do that? 有一个简单的方法吗? I set the device info only in portrait now I've a view controller in which there are a media player and I think it's better to watch this video in landscape mode. 我现在仅以纵向设置设备信息,我有一个视图控制器,其中有一个媒体播放器,我认为最好以横向模式观看此视频。 I tried this methods: 我尝试了这种方法:
- (BOOL)shouldAutorotate
: doesn't work - (BOOL)shouldAutorotate
:不起作用 - (NSUInteger)supportedInterfaceOrientations
: doesn't works - (NSUInteger)supportedInterfaceOrientations
:不起作用 You know if there's a way to solve this without redo all app inserting category? 您知道是否有一种方法可以解决此问题,而无需重做所有应用插入类别吗?
You have 2 things to do : 您有2件事要做:
Set the supported device orientations on the target info 在目标信息上设置支持的设备方向
Set the (NSUInteger)supportedInterfaceOrientations
method for your viewController. 为viewController设置(NSUInteger)supportedInterfaceOrientations
方法。 If this view is only supposed to show the video I guess you should only allow UIInterfaceOrientationMaskLandscape
. 如果此视图仅应显示视频,我想您应该只允许UIInterfaceOrientationMaskLandscape
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.