我如何识别 self.editButtonItem 按钮的单击事件?
我使用代码将 UINavigationController 的左栏按钮设置为编辑按钮,
leftBarButton = self.editButtonItem;
我想更改其他按钮相对于编辑按钮的单击操作的一些禁用/启用属性。
如何判断编辑按钮是否被按下?
I set my left bar button of UINavigationController as edit button using the code
leftBarButton = self.editButtonItem;
I want to change some disable/enable properties of other buttons with respect to the edit button's click action.
How can i find whether the Edit button is pressed or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
编辑按钮的操作会向您的视图控制器发送
setEditing:animated
消息。在您的子类中重写此设置,以便在进入或离开编辑模式时执行其他操作。请务必在最后调用
super
实现来管理到编辑视图的其余转换。The edit button's action sends your view controller the
setEditing:animated
message. Override this in your subclass to perform other actions when entering or leaving edit mode.Be sure to call the
super
implementation at the end to manage the rest of the transition to editing view.所以最后我得到了解决方案......
这个方法将被调用,而不改变
self.editButtonItem
按钮的原始行为。So finally i got the solution...
This method will be called with out changing the original behavior of
self.editButtonItem
button.在斯威夫特中:
In Swift:
在 Swift 中,您可以按照以下方法操作:
In Swift you can follow the below methods:
更新:
将被称为
http://developer .apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html
updated:
will be called
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html