TableView not responsing to an "edit" button in UINavigationController
My application is a shopping list, with a UINavigationController pushing a UITableViewController. The navigation controller has an "Edit" button that handles deleting and rearranging the order of rows.
Everything is working perfectly so far. However I decided to include iAd in the application. I was able to do that in the UITableViewController, but the iAd scrolls with the TableView. So I followed Ray Wenderlich's tutorial on how to include an iAd in a TableView, and his solution was to SubClass UIViewController开发者_运维百科 and nest the TableView inside.
Now this method worked perfectly well except for one thing that I can't really get my head around. The tableView doesn't respond to the Edit button anymore. Tapping the edit does absolutely nothing! Can someone please explain why is this happening and what is the solution to it?
I'm pretty sure you need to handle the setEditing message yourself. You'll want to override setEditing:animated:
in your view controller so it looks something like this.
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.tableview setEditing:editing animated:animated];
}
If we could see the source code for UITableViewController
, the implementation of this method would probably look something like this.
精彩评论