我有两个问题:
问题 1:我正在尝试更改导航返回按钮,我是从我的父 ViewController 中进行的:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"imgrdy"]) {
VCImageEditingViewController *ieVC = (VCImageEditingViewController *)segue.destinationViewController;
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle: @"New" style:UIBarButtonItemStyleBordered target:nil action:@selector(handleNewBtnNav:)];
[[self navigationItem] setBackBarButtonItem: newBackButton];
}
}
-(IBAction)handleNewBtnNav:(id)sender {
UIAlertView *alertNew = [[UIAlertView alloc]initWithTitle:@"New photo" message:@"Are you sure?" delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
[alertNew show];
}
标题确实已更改,但未显示警报。我试图将目标更改为“self”和“ieVC”,但仍然没有。
问题2:有没有办法只改变一个ViewController的后退按钮的标题?还是我必须对每个父 ViewController 进行相同的更改?
谢谢你。