No IB jump page for iPhone Development

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.