简体   繁体   English

设置视图控制器的方向横向

[英]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.

相关问题 一种View Controller iOS的横向 - Landscape orientation for one view controller ios 模态视图控制器强制iOS 6中的横向方向 - Modal View Controller force Landscape orientation in iOS 6 禁止自动定向为横向,可以手动将一个控制器设置为横向 - Forbid auto orientation to Landscape, can manually set one controller to landscape 一个横向控制器 - One controller in landscape orientation 如何从具有横向方向的视图控制器中以纵向显示新的纵向视图控制器? - How can I modally display a new view controller with a portrait orientation, from a view controller that has a landscape orientation? 强制iOS方向在一个模态视图控制器上横向移动 - Force iOS orientation to landscape on one modal view controller 如何允许特定的视图控制器同时支持横向和纵向 - How to allow a particular view controller to support for both landscape and portrait orientation iOS 7 - 仅在一个视图控制器中限制横向方向 - iOS 7 - Restrict landscape orientation only in one view controller iOS:在不启用View Controller上横向模式的情况下处理方向更改 - iOS: Handle Orientation change without enabling landscape mode on View Controller 如何使用滑动菜单为单视图设置横向? - How to set landscape orientation for single view using sliding menu?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM