故事板内容如下:
跑起来是:
1.在Second View Controller中隐藏导航栏返回按钮
编写SecondViewController类的viewDidLoad:方法:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.hidesBackButton = YES; // 隐藏返回按钮
// [self.navigationItem setHidesBackButton:YES animated:YES]; // 隐藏返回按钮
}
2.设置导航栏返回按钮的标题内容
编写ViewController类的viewWillDisappear:方法和viewWillDisappear:方法:
- (void)viewWillDisappear:(BOOL)animated {
self.navigationItem.title = @"Cunstom";
}
- (void)viewWillAppear:(BOOL)animated {
self.navigationItem.title = @"View 1";
}