【发布时间】:2014-04-27 05:23:00
【问题描述】:
为了强制改变设备方向,我从here获取代码
但是苹果可以拒绝使用 setOrientation: 的应用程序吗?
有一些经验吗?
或者可能有人有 100% 的工作并且不能被 Apple 拒绝,解决方案?
if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) {
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
int orientationPortrait = UIInterfaceOrientationPortrait;
NSMethodSignature *sig = [[UIDevice currentDevice] methodSignatureForSelector:@selector(setOrientation:)];
NSInvocation* invo = [NSInvocation invocationWithMethodSignature:sig];
[invo setTarget:[UIDevice currentDevice]];
[invo setSelector:@selector(setOrientation:)];
[invo setArgument:&orientationPortrait atIndex:2];
[invo invoke];
}
}
好的,谢谢,我会试试这个sn-p。
【问题讨论】:
-
你最好问问苹果,他们是唯一的参考。
-
stackoverflow.com/a/7280833/986169 有点旧,但我认为它仍然相关
标签: ios iphone uideviceorientation