2

使用下面的代码,我正在打开一个信息屏幕。一切正常,屏幕打开,标题显示为我想要的,但是我无法更改默认的后退按钮标题

我应该如何在 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

    }
}
4

1 回答 1

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;

    }
}
于 2013-09-24T07:52:47.930 回答