为了强制改变设备方向,我从这里获取代码
但苹果可以拒绝使用的应用程序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];
}
}
好的,谢谢,我会试试这个片段。