如何只设置某个controller视图为横屏

iOSLearn 2013-03-14 03:31:59
要做视频播放的视图,要求横屏播放

可是我的整个应用是只支持竖屏

ios5下在视频视图横屏用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

可是ios6下横屏怎么写?

谢谢
...全文
5646 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
乌托邦长空 2014-07-06
  • 打赏
  • 举报
回复
14楼正确,一定要在父类的viewController上面设置,比如所有的ViewController都是在TabbarViewController之上,那么就应该在TabbarViewController里面设置 - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 即可 同理,如果是在某一个NavigationController里面,那么就设置这个NavigationController即可
happysean8 2014-07-06
  • 打赏
  • 举报
回复
一定要在父类的viewController上面设置
wzdh_12 2014-06-27
  • 打赏
  • 举报
回复
wangqing1970 2013-06-04
  • 打赏
  • 举报
回复
iOS6的方法楼上面都有说明了,你要注意VC的结构。如果没有起到你要的效果,就是当前VC在当前Windows上还有父VC
u010944460 2013-06-03
  • 打赏
  • 举报
回复
我是C小姐 2013-05-31
  • 打赏
  • 举报
回复
能教教代码怎么写么?我也用了navigationcontroller,但是代码不知道怎么写呢,求大神救救小女子吧
Night-Wish 2013-05-13
  • 打赏
  • 举报
回复
还有一个比较关键的地方,在appdelegate中用window.rootViewController=yourrootviewcontroller替换原来ios5中的 [window addsubview:yourrootviewcontroller.view]
Night-Wish 2013-05-13
  • 打赏
  • 举报
回复
首先,你得说明你的整个视图控制器的结构是怎么样的,在IOS6下,这个层次很重要,不然就算你的某个视图中加了那几个控制旋转的方法也起不了作用;你如果用了navigationcontroller,那么请在根navigationcontroller中填写控制旋转的方法就可以了,如果你其他视图要另外控制不同的旋转方向,就可以给再加一个navigationcontroller,旋转代码同理写在这个navigationcontroller中;这也就以为着你需要继承写navigationcontroller用来填写旋转方向的代码;
tubo_true 2013-05-09
  • 打赏
  • 举报
回复
引用 8 楼 wshcdr 的回复:
在view里重栽以下方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
up 但-(BOOL)shouldAutorotate 这个方法 YES也可
wshcdr 2013-05-08
  • 打赏
  • 举报
回复
在view里重栽以下方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
qqqwww198273 2013-04-27
  • 打赏
  • 举报
回复
这个问题我之前也有遇到,也是米为了播放视频,你试试
qqqwww198273 2013-04-27
  • 打赏
  • 举报
回复
最近很多人在问这个问题?? 在相对应的视图控制器(ViewController.m)的viewDidLoad方法中加入下面代码 CGAffineTransform transform = CGAffineTransformIdentity; transform = CGAffineTransformRotate(transform, M_PI/2); self.view.transform = transform; 注意此时视图横屏了但是状态栏还是纵屏显示的,所以需要修改状态栏方向(alertview的方向也会随之修改) [[UIApplication sharedApplication]setStatusBar。。。。。
hslinux 2013-04-02
  • 打赏
  • 举报
回复
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationMaskLandscapeLeft); } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscapeRight; } -(BOOL)shouldAutorotate { return YES; } 5,6通吃。
iOSLearn 2013-03-20
  • 打赏
  • 举报
回复
引用 3 楼 dream238 的回复:
iOS6的话,文档里说明:shouldAutorotateToInterfaceOrientation: Returns a Boolean value indicating whether the view controller supports the specified orientation. (Deprecated in iOS 6.0. Override t……
有代码吗? 谢谢
ArcRain 2013-03-15
  • 打赏
  • 举报
回复
iOS6的话,文档里说明:shouldAutorotateToInterfaceOrientation: Returns a Boolean value indicating whether the view controller supports the specified orientation. (Deprecated in iOS 6.0. Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.) 重载supportedInterfaceOrientations 和 preferredInterfaceOrientationForPresentation 两个函数协作完成。
打转的风铃 2013-03-15
  • 打赏
  • 举报
回复
如果是全部竖屏,就在plist里面设置,如果每个页面不一样,就在不同页面设置,ios6废弃了这个方法!
iOSLearn 2013-03-15
  • 打赏
  • 举报
回复
木有回答的吗??????

29,031

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧