要强制更改设备方向,我会从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];
}
}
好的,谢谢,我会尝试使用此代码段。
答案 0 :(得分:1)