iphoneuimodaltransitionstyle

how to switch view with a part of screen


I have a navigation bar on the top and a tab bar on the bottom. Then I place a info light button on the navigation bar. My task is press the info button to switch the middle area to another view and keep the navigation bar and the tab bar standing still.

-(IBAction) infoButtonPressed:(id)sender
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController pushViewController:infoView animated:YES];
[infoView release];

}

with this code above, I only made the view switching like a translation move. I wish to have a flip move. How can I do?

- (IBAction)infoButtonPressed:(id)sender;
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:nil];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:infoView animated:YES];

[infoView release];
}

and with this one I switch the screen on the flip way but it switch the whole screen. I want the tab bar stand still. I don't want the tab bar switch too.


Solution

  • It's not clear what you are trying to accomplish.

    If you want a modal view, then you should use something like

    [self presentModalViewController:navController animated:YES];
    

    This way your previous screen will be left in the same way unless you dismiss it. If you intend to have a navigation and a tab bar in your modal view, then declare that view as a TabBarController, and you can modally provide it a navigationBar.

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:infoView];
    
    navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:navController animated:YES];