user1118019
user1118019

Reputation: 3959

custom UIView in UITableViewCell blocks uitableviewcell from reciving an event

I have a custom UITableViewCell i.e. I subclassed UITableViewCell class when populating each cell (or row) of the uitableview, i am creating my custom UITableViewCell, which composes of an image and some labels.

now when I override the following method in my custom 'UITableViewCell' class,

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    NSLog(@"CLICKED CLICKED CELL CLICKED CLICKED");
    [super touchesBegan:touches withEvent:event];
 }

it never gets called if i click on the custom views i added to the my custom uitableviecell, but it is fine (event triggered) when i click on the region where there is no custom view on top of it.

my goal is simple, i want to detect any touches in each row (uitableviewcell) in the uitableview.

Upvotes: 0

Views: 826

Answers (2)

Yunus Nedim Mehel
Yunus Nedim Mehel

Reputation: 12369

I have experienced a similar problem today, I was unable to select the cell, since it had a custom UIView with a scrollView on it. Try setting userInteractionIsEnabled = false on your subviews of your UIView.

Upvotes: 3

lu yuan
lu yuan

Reputation: 7227

plz try to override this method

 - (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {}   

Upvotes: 0

Related Questions