オリエンテーションをサポートするサンプルコードをIOS6.0に実装しましたが、正常に動作しますが、ipad 1(IOS 5.1)オリエンテーションで実行した場合、同じアプリケーションはサポートされません。
3 に答える
1
iOS 5以下の回転をサポートするには、ViewControllerに古い回転方法を実装する必要があります。
はい、メソッドは非推奨になりましたが、古いバージョンのiOSでは引き続き必要です。
于 2013-01-21T11:18:22.950 に答える
1
iOS 6以降では、これらの方法を使用してください
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate {
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
iOS5.0およびそれ以前のすべてのバージョンではこれを使用します
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
于 2013-01-21T11:23:07.823 に答える
0
.mファイルで次のコードを使用します。
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return NO;
}
else {
return YES;
}
}
これはiOS5.1、6.1.3および7.0.2で機能します。
于 2013-10-22T06:47:37.707 に答える