iphone - didSelectRowAtIndexPath: only being called after long press on custom cell
same problem happened with me because I have added a tap gesture recogniser over it. If you have used any gesture recognizer try removing it and check if it causing the problem.
EDIT: Solution as commented by the Ali:
If you have used tap gesture you can use [tap setCancelsTouchesInView:NO];
I was faced with a similar issue:
For me, the problem was because my UITableView
was added to an UIScrollView
and more specifically to its contentView
.
It appears that inside the contentView
, I had to stay press 2-3 sec to fire the didSelectRowAtIndexPath
method.
I moved my TableView to self.view
instead of contentView
and it solved the problem!
Maybe you will call the method
[tableView deselectRowAtIndexPath:indexPath animated:NO];
before Push ViewController or Other Operation. Like
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// 1. manual call this method to deSelect Other Cell
[tableView deselectRowAtIndexPath:indexPath animated:NO];
// 2. than do other operation
PushViewController Or Some Animation ....
}
that`s solve my problem .