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