Generic-user-small Shahed Moolji 6 posts

HI,

In the setEditing:animated: method you check to see if the current state != previous state.

Is this really necessary ?

Will the method not be called only when there is a change ?

Or is there a case when it can be called more than once with the same state for editing param?

Thanks

 
Photo_13_small Bill Dudney 372 posts

Hi Shahed,

Is this the code you are referring to from the IngredientsViewController;


- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    if(self.editing != editing) {

If so, yes this method can be called multiple times with the same value for the editing flag. We only want to change the state when the editing state actually changes.

 
Generic-user-small Shahed Moolji 6 posts

Thanks Bill,

Yes that is the code.

I initially thought that it would only get fired if you click on the “Done/Edit” button which
keeps track of its toggle state internally.

Thanks
Shahed.

3 posts, 2 voices