iphone - 如何更改 UINavigationBar 中的编辑/完成按钮标题

标签 iphone objective-c xcode

如果为 tableview 启用了编辑模式,它会显示一个标题为“编辑”的按钮,当按下它时,它会将标题更改为“完成”

我想知道是否有办法将“完成”按钮的标题更改为其他名称?

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

我使用的代码是

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

现在编辑是更改

如何让其他事情完成?

最佳答案

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

- (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");
    }
}

它的工作方式类似于编辑:-

enter image description here

enter image description here

关于iphone - 如何更改 UINavigationBar 中的编辑/完成按钮标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13429743/

相关文章:

iphone - 后台线程下载图像后重新加载 UIWebView 中的图像

ios - MPMoviePlayerViewController 方向权限

ios - 如何在 NSMutableDictionaries 的 NSMutableArray 中搜索特定键的值?

xcode - Swift Xcode 调试自动完成

ios - 如何以编程方式设置 ImageView 的方向

iphone - UICollectionView奇数单元格留空

iphone - 连接到 adhoc wifi 时使用 3g 上网(使用私有(private) API)

objective-c - 在 Mac 上创建自定义文件扩展名

ios - 在 UITableView 中插入一行后调用 numberOfSectionsInTableView

ios - 如何将NSDictionary数据添加到NSMutableArray?