How can I make my tableview enter editing mode?
for some reason I can't get my tableview to enter editing mode. It's a little harder than it might seem because I'm using some open source code to make a calendar (iCal esque) with a tableview under it, and it's not quite as straightforward as just using a regular tableview.
Basically, I have two classes. One (let's say Class A) is a UIViewController and the other (Class B) is that viewController'开发者_StackOverflows datasource and tableview delegate. In Class B, I've implemented
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
which works fine, but if I put an edit nav bar item in Class A (the view controller), nothing happens. Am I forgetting certain protocols, or certain special methods that I need to write? Thanks for any help, and apologies if I'm missing something, I'm just learning to work with other people's code.
EDIT:
I just implemented this code in Class A (the view controller)
- (void)setEditing:(BOOL)editing animated:(BOOL)animate {
self.tableView.editing = editing;
}
And that makes the editing circle come up, but it is not animated.
You almost have it already. Call super too.
- (void)setEditing:(BOOL)editing animated:(BOOL)animate {
[super setEditing:editing animated:animate];
[self.tableView setEditing:editing animated:animate];
}
精彩评论