ゲームセンターがロードされるとき、デフォルトの向きはポートレートです。 ランドスケープモードでロックするには、カテゴリを追加してください。i OS 6のランドスケープでのゲームセンターのログインロック
@implementation GKMatchmakerViewController (LandscapeOnly)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate {
return NO;
}
@end
iOS 6以下では正常に動作していますが、iOS6ではエラーが表示されます。キャッチされない例外により「UIApplicationInvalidInterfaceOrientation」、理由にアプリを終了
:「サポートされている方向は、アプリケーションと共通の方向性を持っていない、とshouldAutorotateがYES戻っている」が
ソリューションを説明してください。
すごいです!あなたは私のお尻を保存しました:) – yonix
ありがとう!私のお尻も保存されました:) –
私の場合も私の場合、UIBNavigationControllerではなくUIViewController(そのサブクラス)を使用していましたが、まだメソッド番号2を追加する必要がありました。この答えでUIBNavigationControllerをUIViewControllerに置き換えることができます。 –