私は、縦向きと縦向きの両方をサポートする iPhone アプリケーションに取り組んでいます。
以前の XCode4.5.1 では、次の方法でこの問題を解決しました。
- AppDelegate での rootViewController の設定
次のように shouldAutorotateToInterfaceOrientation に言及します。
-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation { return UIInterfaceOrientationIsPortrait(toInterfaceOrientation); }
info.plist ファイルで supportedInterfaceOrientation について言及する
現在、新しいXCodeでも同じことを行っていますが、iPhoneシミュレーターv6.0では回転が適切にサポートされていません。
私もこれらの方法で試しました:
-(BOOL) shouldAutorotate {
BOOL returnValue = NO;
int interface = [self preferredInterfaceOrientationForPresentation];
if(UIInterfaceOrientationIsPortrait(interface)) {
// Code to handle portrait orientation
returnValue = YES;
}
else {
// Code to handle Landscape orientation
returnValue = NO;
}
return returnValue;
}
- (NSUInteger) supportedInterfaceOrientations {
return (UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown);
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return (UIInterfaceOrientationPortrait |
UIInterfaceOrientationPortraitUpsideDown);
}
iOS > 4.3 のすべてのバージョンで両方の縦向きをサポートする方法を教えてください。
前もって感謝します、 ムルナル