views:

68

answers:

1

First - I read all similar topics and non of them work for me. I have few View Controllers. And I change them by that code:

- (void)flipToAzbukaMenu {
    AzbukaMenuController *aAzbukaMenu = [[AzbukaMenuController alloc] initWithNibName:@"AzbukaMenu" bundle:nil];
    [self setAzbukaMenuController:aAzbukaMenu];
    [aAzbukaMenu release];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO];
    [viewController.view removeFromSuperview];
    [azbukaArcadeController.view removeFromSuperview];
    [self.window addSubview:[azbukaMenuController view]];

    [UIView commitAnimations];
}

Also I have proper key in plist that allows me to start the application in landscape mode. When the app starts it has proper orientation (landscape), but when I change my view it becomes portrait and becomes again landscape only after rotating device 270 degree (not 90 lol). How do I force the app to show all views in landscape mode?

UPD:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ((interfaceOrientation==UIInterfaceOrientationPortrait)||(interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown))
    {
        return NO;
    }
    if ((interfaceOrientation==UIInterfaceOrientationLandscapeLeft)||(interfaceOrientation==UIInterfaceOrientationLandscapeRight))
    {
        return YES;
    } else {
        return YES;
    }
}
A: 

There are two landscape modes and two portrait modes. One is landscape left, the other is landscape right. For instance, if you flip to one of the portrait modes (let's say, with home button on the bottom) from landscape left, you are going to get a 270 degree rotation.

As for how to force your views to stay in landscape (pick one of the two modes), just do something like:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

This will always cause that view to be displayed in landscape left orientation.

jer
correction - works only with code from UPD.
Andoriyu