Problem with pushing multiple view controllers in one code block
In order to restore my iphone application to a paticular view controller, i am trying to push the view controllers one after another in the application delegate.
The order of the view controllers on the stack initially is :
1. Root View Controller 2. First View Controller 3. Second View ControllerWhat I want is that when my application launches, it should go directly to the Second view controller. For this I have written the following code :
[self.navigationController popToRootViewControllerAnimated:NO];
RootViewController *rootViewController = [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:rootViewController animated:NO];
FirstViewController *firstViewController=[[NSClassFromString(@"FirstViewController") alloc] initWithNibName:@"FirstViewController" bundle:[NSBundle 开发者_开发问答mainBundle]];
[self.navigationController pushViewController:firstViewController animated:NO];
SecondViewController *secondViewController=[[NSClassFromString(@"SecondViewController") alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:secondViewController animated:NO];
The problem is that when the Second view controller loads, its back button is named "Back" , instead of the title of the first view controller. I have not explicitly set a back button in the third view controller.
Regards
You should set the title of the UINvaigationItem for FirstViewController, which will be aditionally seen in the center of navigation bar.
精彩评论