ios - 我如何更改 View Controller 中的后退按钮标题,如下所示在 ios5 中使用 segue 推送

标签 ios uinavigationbar

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

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

    }
}

最佳答案

在这个论坛上进行了大量搜索和尝试各种解决方案之后,我终于找到了一些有用的东西,我将其发布在下面,以帮助其他陷入困境的人。

- (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;

    }
}

关于ios - 我如何更改 View Controller 中的后退按钮标题,如下所示在 ios5 中使用 segue 推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18959542/

相关文章:

ios - popview 上消失的 UIButtons

ios - 键盘出现时弹出 View 箭头移动

html - 如何在当前菜单中制作下拉菜单

ios - 添加覆盖屏幕内容的自定义导航栏

ios - 如果点击后退按钮,导航栏标题颜色不会改变

ios - 我的 Xcode 8 有什么问题?我什至无法编译新项目?

ios - Objective-c, Action 完成后未删除SpriteKit粒子

ios - 如何以编程方式扩展/调出搜索栏?

ios - 隐藏状态栏时,我的导航栏在 iOS 7 中向上移动

ios - 如何将背景图像应用于导航栏