自动旋转锁,以编程方式 [英] Autorotation lock, programmatically

查看:97
本文介绍了自动旋转锁,以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否有可能仅通过一个视图以编程方式锁定iPhone的自动旋转吗? 我想为半透明视图提供某种帮助,但我想仅支持横向显示,即使所有其他视图都可以旋转. 因此,当此视图位于顶部时,我希望锁定旋转.

Does anybody know if there is a possibility to lock autorotation of iPhone programmatically for just one view? I want to make some kind of help with semi-transculent view, but I want to support only landscape orientation even all other views can rotate. So I wish to lock rotation when this view is on the top.

tnx

更多详细信息:一个UIController具有7个UIView ...并且我希望在最后一个出现在顶部时锁定自动旋转.

More details: one UIController has 7 UIView...and I wish to lock the autorotation just when the last one occurs on the top.

推荐答案

使用以下内容...

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

这篇关于自动旋转锁,以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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