iPhone SDK: Locking the orientation

自古美人都是妖i 提交于 2019-12-10 18:55:16

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/600284/iphone-sdk-locking-the-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!