How to jump on an iOS page

Source: Internet
Author: User

When the page jumps, if you want to use Pushviewcontroller, you must set the Uinavigationcontroller in Appdelegate, otherwise pushviewcontroller is invalid.
And with Pushviewcontroller from a jump to B, on the B page comes with a "back" button to return to the previous page. Similar to

This setting, in Appdelegate

1-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {2Self.window =[[UIWindow alloc]initwithframe:[[uiscreen mainscreen] bounds];3Uiviewcontroller *controllera =[[Viewcontroller alloc]init];4Uinavigationcontroller *nav =[[Uinavigationcontroller alloc] initwithrootviewcontroller:controllera];5     6Self.window.rootViewController =nav;7 [Self.window makekeyandvisible];8     9     returnYES;Ten}

This is written in the Jump page method in Controllera

-(void) turntoothercontroller{    *controllerb = [[Controllerb alloc]init];    [Self.navigationcontroller Pushviewcontroller:controllerb animated:yes];}

This way, the navigation bar will always be there. If you do not want the navigation bar, then write in Appdelegate

1 -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {2     self.window = [[UIWindow alloc]initwithframe:[[uiscreen Mainscreen] bounds]]; 3     Uiviewcontroller *controllera = [[Viewcontroller alloc]init]; 4     Self.window.rootViewController = Controllera; 5     [Self.window makekeyandvisible]; 6     7     return YES; 8 }

The following method is generic and does not require the setting of Rootviewcontroller.

[Self Presentviewcontroller:mainview animated:yes completion:nil]; // Controller's own properties

The following is required

[Self.navigationcontroller Pushviewcontroller:mainview animated:yes]; // Uinavigationcontroller must be set in Appdelegate, otherwise pushviewcontroller is not valid.  // and after using Pushviewcontroller, a "back" button will be returned to the previous page on page B. 

How to jump on an iOS page

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.