1
votes

In my rootViewController, I re-implemented the method shouldAutorotateToInterfaceOrientation like this.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    switch (toInterfaceOrientation) {
        case UIInterfaceOrientationPortrait:
            NSLog(@"Orientation - Portrait");
            break;
        case UIInterfaceOrientationLandscapeLeft:          
            NSLog(@"Orientation - Left");
            break;
        case UIInterfaceOrientationLandscapeRight:
            NSLog(@"Orientation - Right");
            break;
        case UIInterfaceOrientationPortraitUpsideDown:
            NSLog(@"Orientation - UpsideDown");
            break;
        default:
            break;
    }
    return YES;
}

When I rotate my device, this method is called for LandscapeRight, LandscapeLeft and UpsideDown, but not for the Portrait orientation.

At the launch the view is in portrait mode, and this method is called with UIInterfaceOrientationPortrait. But when I rotate the device this method is not called only for this orientation.

1

1 Answers

0
votes

shouldAutorotateToInterfaceOrientation is normally only called once to tell the caller, what orientations the app will support (an ORed value or YES for all). You might be looking for willRotateToInterfaceOrientation:duration: to check the orientation and/or do some rearrangements before displaying the new orientation.