使用下面的代码我打开一个信息屏幕。 一切正常,屏幕打开,标题显示为我想要的,但我无法获得默认的后退按钮标题更改
我应该怎么做xcode5
感谢
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"infoRegularSegue"])
{
FirstViewController *destViewController = segue.destinationViewController;
destViewController.title = NSLocalizedString(@"Information", title of information view);
//this code below does not work
destViewController.navigationItem.backBarButtonItem.title = @"test";
//ive also tried leftbuttonitem
}
}
答案 0 :(得分:7)
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"infoRegularSegue"])
{
FirstViewController *destViewController = segue.destinationViewController;
destViewController.title = NSLocalizedString(@"Information", title of information view);
//here is the solution to my problem
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"Return", returnbuttontitle) style: UIBarButtonItemStyleBordered target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
}
}