0

After presenting a modal view on my UITableView controller when editing is on, I found that the values of self.editing and self.tableView.editing are different when the controller is dismissed (self.editing was still on but self.tableView.editing had gone off and the tableView was in a strange state).

To correct this, I did [self setEditing:NO animated:YES] when presenting the modal view.

I've discovered that these two lines do not do the same thing:

[self.tableView setEditing:NO animated:YES];
[self setEditing:NO animated:YES];

My questions are:

(1) why is there a difference in those commands and

(2) how can the state of self.editing and self.tableView.editing be different?

PinkeshGjr
  • 8,460
  • 5
  • 41
  • 56
Jeff
  • 2,659
  • 1
  • 22
  • 41

1 Answers1

0

According the documentation

self.editing

A Boolean value indicating whether the viewController currently allows the user to edit the view contents

self.tableView.editing

A Boolean value that determines whether the table view is in editing mode.

I think you can understand by the definition it self, viewController editing refers to if the viewController allows editing.

Gihan
  • 2,476
  • 2
  • 27
  • 33
  • Thank you, Gihan, that cleared it up. I had confused the two, but they are only loosely related. In a tableView controller. [self setEditing:] needs to call super and the tableView's setEditing: method. – Jeff Jan 13 '19 at 06:41