Документация Apple подразумевает, что для редактируемого UITableView с кнопкой «Редактировать / Готово» вы должны создавать и удалять кнопку каждый раз, когда она переключается.
Вот пример проекта кода BonjourWeb, который делает это:
if (editing) {
// Add the "done" button to the navigation bar
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAction:)];
self.navigationItem.leftBarButtonItem = doneButton;
[doneButton release];
[self addAddButton:YES];
} else {
if ([self.customs count]) {
// Add the "edit" button to the navigation bar
UIBarButtonItem *editButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editAction:)];
self.navigationItem.leftBarButtonItem = editButton;
[editButton release];
}
Это действительно лучше, чем просто редактировать заголовок кнопки? Есть какая-то оптимизация производительности, которую я не вижу? Или это просто плохой пример источника?