编辑完成时是否有“setEditing”的逆操作?
我正在开发一个传统的 iPhone UINavigationController 应用程序,带有自动后退按钮等。
我正在研究按下“编辑”按钮时的情况。左后退图标变暗,我的新图标出现,然后一旦我再次点击“编辑”按钮,后退按钮就会回来。
到目前为止,后退按钮消失了,我的新按钮进来了,但我无法将其放回去!我知道代码应该是什么,但我不知道在哪里调用它。
这是我到目前为止所拥有的:
(void)setEditing:(BOOL)editing animated:(BOOL)animated {
[self.navigationItem setHidesBackButton:editing animated:animated]; //fades back button
//de 006 - Load in Move section button here.
UIBarButtonItem *saveButton = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize
target:self action:@selector(altersection:)] autorelease];
self.navigationItem.leftBarButtonItem = saveButton;
基本上我想要 (void)setEditing:(BOOL)editingAnimated:(BOOL)animated {
的逆,我可以在其中执行以下操作:
self.navigationItem.leftBarButtonItem = nil; //custom button hide
self.navigationItem.hidesBackButton = NO; //replace back button
是否有 的逆>(void)setEditing:(BOOL)编辑
?
I'm working on a traditional iPhone UINavigationController app, with automatic back buttons etc.
I am working on when an 'edit' button is pressed. The LHS back icon dims, my new one comes in, and then once I tap the 'edit' button again, the back button comes back.
So far, the back button goes away, and my new one comes in, but I can't put it back! I know what the code should be, but I don't know where to call it.
Here is what I have so far:
(void)setEditing:(BOOL)editing animated:(BOOL)animated {
[self.navigationItem setHidesBackButton:editing animated:animated]; //fades back button
//de 006 - Load in Move section button here.
UIBarButtonItem *saveButton = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize
target:self action:@selector(altersection:)] autorelease];
self.navigationItem.leftBarButtonItem = saveButton;
Basically I want the inverse of (void)setEditing:(BOOL)editing animated:(BOOL)animated {
, where I can do:
self.navigationItem.leftBarButtonItem = nil; //custom button hide
self.navigationItem.hidesBackButton = NO; //replace back button
Is there an inverse of (void)setEditing:(BOOL)editing
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定我完全理解这个问题:/
当您按下“完成”按钮时,我相信
setEditing
会再次被调用,但NO
作为 编辑参数。因此,在 setEditing 中,您可以检查:
查看我们是否正在进入或离开编辑状态。
Not sure I completely understood the question :/
When you press the "Done" button, I believe
setEditing
get's called again, but withNO
as the editing parameter.So in setEditing you could check for:
To see if we are entering or leaving the editing state.
您只需在 setEditing 中输入 if 条件即可。编辑按钮上的任何操作都会调用相同的方法。
您可以使用类似的代码
您还可以在 if 中检查这两个条件。
You just have to pu if condition in setEditing. Same method gets called on any action on edit button.
You can have code like
You can also check for both conditions in if.