デバイスの向きを強制的に変更するには、ここからコードを取得します
しかし、アップルは使用するアプリを拒否できます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];
}
}
わかりました、ありがとう、このスニペットで試してみます。