i am subclassing UITableViewCell
in my UITableView
. i did it about a thousand times before but now i am trying to catch this delegate event :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath;
when the cell is touched this callback should be invoked. but i invoked only if i am pressing like 6 seconds or 6 times after the touch, but not every touch.
the tableview is a subview of a subclassed UIView
and i call this in the awakeFromNib
:
-(void)awakeFromNib{
_table_view.delegate = self;
_table_view.dataSource = self;
}
the tableview draws itself just fine but this event is not working well. any ideas?
here is the UITableViewCell
subclass code .m
#import "FLBlockedPersonCell.h"
@implementation FLBlockedPersonCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
[super setHighlighted:highlighted animated:animated];
}
@end
Maybe you add UITapGestureRecognizer on your view, when you touched it, the UITapGestureRecognizer first response.
When the cell is touched this invoke should happen:
-(void) tableView:(UITableView*) tableView didHighlightRowAtIndexPath:(NSIndexPath*) indexPath
The didSelect invokes only if you really selected a cell, not just tapped it. Also several methods like shouldHighlight and willSelect will invoke upon touch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With