Apple's documentation implies that for a UITableView editable with an "Edit/Done" button, you should create and destroy the button each time it's toggled.
Here's a snippet of code "BonjourWeb" sample code project that does this:
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];
}
Is this really better than just editing the title of the button? Is there some performance optimisation that I'm not seeing? Or is this just bad example source?