如何在UINavigationBar中更改编辑/完成按钮标题 [英] How to change Edit/Done button title in UINavigationBar

查看:139
本文介绍了如何在UINavigationBar中更改编辑/完成按钮标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果为桌面视图启用了编辑模式,则会显示一个标题为编辑的按钮,按下该按钮会将标题更改为已完成

If Editing mode is enabled for the tableview it shows a button titled Edit, when pressing it it changes the title to done

我想知道是否有办法将完成按钮标题更改为其他内容?

i was wondering if there is a way to change the Done Button title to something else ?

我已经更改了完成按钮的标题。

i already changed the title for the done button.

我使用的代码是

self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.editButtonItem.title = @"Change";

现在编辑是改变

如何完成其他事情?

推荐答案

您可以像这样更改编辑按钮的标题: -

You can change the title of the edit button like this:-

- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
    // Make sure you call super first
    [super setEditing:editing animated:animated];

    if (editing)
    {
        self.editButtonItem.title = NSLocalizedString(@"Cancel", @"Cancel");
    }
    else
    {
        self.editButtonItem.title = NSLocalizedString(@"Edit", @"Edit");
    }
}

其工作方式如编辑: -

its working like edit:-

TO

这篇关于如何在UINavigationBar中更改编辑/完成按钮标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆