iPhone SDK:锁定方向 [英] iPhone SDK: Locking the orientation

查看:104
本文介绍了iPhone SDK:锁定方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在以前的应用程序中看到了它(忘记了应用程序名称),您可以在其中锁定屏幕的当前方向.

I've seen it on a previous app (forgetting the app name), where you could lock the current orientation of the screen.

是否有一种简单的方法可以完成此操作,例如,只需使用一个按钮即可.

Is there an easy way for this to be done, for example, simply using a button.

推荐答案

只需将一个ivar添加到您的应用程序委托中,即可通过按下锁定按钮来对其进行设置.然后,在所有视图控制器中,您只需检查应用程序委托中的ivar并响应

Just add an ivar to your app delegate that can be set by pressing the locking button. Then in all of your view controllers you can just check the ivar in the app delegate and respond to the

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

根据您的方向信息发短信

message according to your orientation ivar

这篇关于iPhone SDK:锁定方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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