更改 iPhone 编辑按钮的标题
我有一个表格视图,左侧有一个编辑按钮。
我创建了这个编辑按钮,使用
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将编辑按钮的视觉标题更改为“删除”是一个坏主意 - 您可能会发现您的应用程序因执行如此不明智的操作而被拒绝。如果它确实进入商店,您会让用户感到困惑。不要这样做!
如果您想要一个名为“删除”的按钮来执行与删除直接相关的特定操作,并且具有明确的上下文,那就是另一回事了。请注意,破坏性操作按钮通常是红色的,以向用户表明存在破坏性操作,有时会弹出 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
您只需更改按钮标题即可。这是代码
You can just change button title. Here is the code
可行,尽管这可能不是一个好主意。请参阅oculus 的回答。
创建一个 UIBarButtonItem:
然后在
-(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:
Then call
[self setEditing:!self.editing]
in-(void)doSomething
.尝试
Try