0

私のアプリケーションは iOS5 で正常に動作しています。しかし、iOS6 の場合、次の向きの問題が発生しています。

私はViewController VC1を持っています。回転すると (向きを UIInterfaceOrientationLandscapeRight に変更します)、別の ViewController VC2 を提示したいのですが、元に戻すと、VC2 を閉じる必要があり、VC1 は縦長モードにする必要があります。

アプリケーションで tabBar を使用していますが、この機能は最初のタブにのみ必要です。

tabBar で私が書いた

-(BOOL) shouldAutorotate
{
    UINavigationController *nav = (UINavigationController *)self.selectedViewController;
    if ([nav.topViewController isKindOfClass:[MainViewController class]])
    {
        return YES;
    }
    else
    {
        return NO;
    }
} 
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //Here I am writing code for presenting view(using notifications)
    // but When I rotate the device to landscape it's getting called but when I rotate back 
    //to portrait I not getting called.
}

ありがとうございました。

4

1 に答える 1

0

ios 6で試してみてください:(例)

- (BOOL)shouldAutorotate
{
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
   return UIInterfaceOrientationLandscapeRight;

}
于 2013-05-02T09:54:52.740 に答える