先来看两个方法
方法一:
tableView:didDeselectRowAtIndexPath:
Tells the delegate that the specified row is now deselected.
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
Parameters
tableView
A table-view object informing the delegate about the row deselection.
indexPath
An index path locating the deselected row in tableView.
Discussion
The delegate handles row deselections in this method. It could, for example, remove the check-mark image (UITableViewCellAccessoryCheckmark) associated with the row.
方法二:
deselectRowAtIndexPath:animated:
Deselects a given row identified by index path, with an option to animate the deselection.
- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
Parameters
indexPath
An index path identifying a row in the receiver.
animated
YES if you want to animate the deselection and NO if the change should be immediate.
Discussion
Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor will it send UITableViewSelectionDidChangeNotification notifications to observers.
我的代码中有一行这样的代码
[tableView deselectRowAtIndexPath:indexPath animated:NO];
这直接导致我今天晚上,少睡了半个小时。由于我收不到tableView:didDeselectRowAtIndexPath消息,所以行选择取消,就没有被invoke。
睡觉了。