更改 iPhone 编辑按钮的标题

发布于 2024-10-21 13:19:16 字数 176 浏览 4 评论 0原文

我有一个表格视图,左侧有一个编辑按钮。

我创建了这个编辑按钮,使用

self.navigationItem.leftBarButtonItem = self.editButtonItem;

我想知道如何将编辑按钮的标题更改为“删除”

干杯

I have a tableview with an edit button on the left.

I created this edit button using

self.navigationItem.leftBarButtonItem = self.editButtonItem;

I want to know how to change the title of the Edit button to 'delete'

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

策马西风 2024-10-28 13:19:16

将编辑按钮的视觉标题更改为“删除”是一个坏主意 - 您可能会发现您的应用程序因执行如此不明智的操作而被拒绝。如果它确实进入商店,您会让用户感到困惑。不要这样做!

如果您想要一个名为“删除”的按钮来执行与删除直接相关的特定操作,并且具有明确的上下文,那就是另一回事了。请注意,破坏性操作按钮通常是红色的,以向用户表明存在破坏性操作,有时会弹出 UIActionSheet 来确认用户的破坏性操作。

请阅读 Apple 的人机界面指南:

http:// /developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html

Changing the visual title of the edit button to 'Delete' is a bad idea -- you'll probably find your app gets rejected for doing something as ill advised as that. If it does get into the store, you'll confuse your users. Don't do it!

If you want a button called Delete that does something specific directly related to deleting that has a clear context, that's another matter. Note that destructive action buttons are usually a red colour, to signal to the user that there's a destructive action there, and sometimes pop up a UIActionSheet to confirm the user's destructive action.

Please read Apple' Human Interface Guidelines:

http://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html

网白 2024-10-28 13:19:16

您只需更改按钮标题即可。这是代码

self.editButtonItem.title = @"Delete";
self.navigationItem.leftBarButtonItem = self.editButtonItem;

You can just change button title. Here is the code

self.editButtonItem.title = @"Delete";
self.navigationItem.leftBarButtonItem = self.editButtonItem;
空名 2024-10-28 13:19:16

可行,尽管这可能不是一个好主意。请参阅oculus 的回答

创建一个 UIBarButtonItem:

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Whatever" style: UIBarButtonItemStyleBordered target:self action:@selector(doSomething)] autorelease];

然后在 -(void)doSomething 中调用 [self setEditing:!self.editing]

Doable, though it might not be a good idea. See this answer by occulus.

Create a UIBarButtonItem as usual:

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Whatever" style: UIBarButtonItemStyleBordered target:self action:@selector(doSomething)] autorelease];

Then call [self setEditing:!self.editing] in -(void)doSomething.

情何以堪。 2024-10-28 13:19:16

尝试

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"your title" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];

Try

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"your title" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文