Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCell didselectrow event delay

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
like image 878
or azran Avatar asked Dec 09 '13 07:12

or azran


2 Answers

Maybe you add UITapGestureRecognizer on your view, when you touched it, the UITapGestureRecognizer first response.

like image 71
Dracuuula Avatar answered Oct 04 '22 20:10

Dracuuula


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.

like image 20
eagle.dan.1349 Avatar answered Oct 04 '22 20:10

eagle.dan.1349