Is there an inverse of `setEditing` for when editing is complete?
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
?
Not sure I completely understood the question :/
When you press the "Done" button, I believe setEditing
get's called again, but with NO
as the editing parameter.
So in setEditing you could check for:
if(editing) { .... }
To see if we are entering or leaving the editing state.
You just have to pu if condition in setEditing. Same method gets called on any action on edit button. You can have code like
if(self.navigationItem.leftBarButtonItem)
{
self.navigationItem.leftBarButtonItem = nil;
self.navigationItem.hidesBackButton = NO;
}
You can also check for both conditions in if.
精彩评论