2

iPhone 4sと以前のバージョン用に作成されたアプリがありiPhone 5ます。iPhoneではポートレートとポートレートの両方を設定upsidedownし、iPad ではすべての向きのビューを設定しました。私の問題は、iPhone 5 ではハンドルの向きが機能しないが、以前のバージョンではうまく機能していることです。xcodeサポートにアップグレードした後、この問題に直面していますiOS 6

また、これらの方法を使用するためのいくつかの解決策を見つけました

"

-(BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

"

それ以外の

" - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation " メソッド...

これも使用した後、同じ問題に直面しています...それで、私の問題は何ですか?これを克服するにはどうすればよいですか?

助けてください。

ありがとうございます

4

1 に答える 1

0

shouldAutorotateToInterfaceOrientation は iOS 6 では機能しません。そのため、iOS 6 の方向には supportedInterfaceOrientations メソッドを使用し、iOS 5 以前では shouldAutorotateToInterfaceOrientation を使用します。次のコードは次のとおりです。

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)    
      return (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation==UIInterfaceOrientationPortrait) ;    
  else     
     return YES;    
}

-(NSUInteger)supportedInterfaceOrientations
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
     return (UIInterfaceOrientationMaskPortrait|
            UIInterfaceOrientationMaskPortraitUpsideDown);
   else       
     return UIInterfaceOrientationMaskAll;       
}
于 2012-11-22T09:34:42.447 に答える