在iPhone私有API上设置界面方向 [英] set interface orientation on iPhone private API
本文介绍了在iPhone私有API上设置界面方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以确认 [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
会让您的应用被Apple拒绝。
Can anyone confirm that [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
will get your app rejected by Apple.
有没有好的替代品?
推荐答案
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientation]是一个私有API,你呢可以发现签名只是只读的(参见这里)。
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientation] is a private API, you can find that is signature is only in read-only (see here).
如果您想将设备方向设置为纵向或其他模式,您应该覆盖shouldAutorotateToInterfaceOrientation:
If you want set the device orientation to Portrait or other mode you should override the shouldAutorotateToInterfaceOrientation:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIDeviceOrientationPortrait);
}
这篇关于在iPhone私有API上设置界面方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文