1. Use UINavigationController to switch between pages in the event Code implemented in AppDelegate. m.
-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions
{
Self. window = [[uiappswalloc] initWithFrame: [UIScreenmainScreen] bounds];
Self. window. backgroundColor = [UIColorwhiteColor];
RootView * r = [[rootViewalloc] init];
UINavigationController * nav = [[UINavigationControlleralloc] initWithRootViewController: r];
Self. window. rootViewController = nav;
[Self. windowmakeKeyAndVisible];
ReturnYES;
}
2. Use the tab bar to switch views
Corresponding button event
-(IBAction) btnTab
{
UITabBarController * tabBarController = [[UITabBarControlleralloc] init];
First * firstViewController = [[first alloc] initWithNibName: nil bundle: nil];
UINavigationController * firstNavigationController = [[UINavigationController alloc] initWithRootViewController: firstViewController];
[FirstNavigationController setNavigationBarHidden: YES animated: YES];
[FirstNavigationController setTitle: @ "first view"];
Second * secondViewController = [[second alloc] initWithNibName: nil bundle: nil];
UINavigationController * secondNavigationController = [[UINavigationController alloc] initWithRootViewController: secondViewController];
[SecondNavigationController setNavigationBarHidden: YES animated: YES];
[SecondNavigationController setTitle: @ "second view"];
Third * thirdViewController = [[third alloc] initWithNibName: nil bundle: nil];
UINavigationController * thirdNavigationController = [[UINavigationController alloc] initWithRootViewController: thirdViewController];
[ThirdNavigationController setNavigationBarHidden: YES animated: YES];
[ThirdNavigationController setTitle: @ "third view"];
Forth * forthViewController = [[forth alloc] initWithNibName: nil bundle: nil];
UINavigationController * forthNavigationController = [[UINavigationController alloc] initWithRootViewController: forthViewController];
[ForthNavigationController setNavigationBarHidden: YES animated: YES];
[ForthNavigationController setTitle: @ "fourth View"];
TabBarController. viewControllers = [NSArray arrayWithObjects: firstNavigationController, secondNavigationController, thirdNavigationController, forthNavigationController, nil];
TabBarController. modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[SelfpresentModalViewController: tabBarController animated: YES];
}
From fanwa Software