Xcode 4.6 と、IOS 5.0 をサポートするアプリがあります。IOS シミュレータ 6 でアプリケーションを実行すると、IOS 5 のときに自動回転が機能します。デバイスでも同じです。
ストーリーボードを使用しました。
注入機能の自動回転中のブール値 - true。
Xcode 4.6 と、IOS 5.0 をサポートするアプリがあります。IOS シミュレータ 6 でアプリケーションを実行すると、IOS 5 のときに自動回転が機能します。デバイスでも同じです。
ストーリーボードを使用しました。
注入機能の自動回転中のブール値 - true。
iOS6 では、ビューを回転させるかどうかを決定するための新しい方法が導入されましたが、iOS5 では古い方法を使用する必要があります。iOS6 の方法のみを使用している可能性があります。これが私が使用するものです:
// New iOS6 autorotate interface.
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
return UIInterfaceOrientationMaskAllButUpsideDown;
else
return UIInterfaceOrientationMaskAll;
}
// Older autorotate interface (for compatibility).
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
else
return YES;
}
iOS5用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
ただし、上記のメソッドは、これを使用するオーバーライドとしてios6では非推奨です
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}