tags:

views:

59

answers:

2

how to detect touch event for table cells i tried this

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    //<my stuff>

    [super touchesBegan:touches withEvent:event];
}

but its not working actuallly i have aUIimage view in table cell and i want to chnage imgae based on tap so my touch event is not working for that cell

+1  A: 

You probably need to set myImageView.userInteractionEnabled = YES;.

jtbandes
i already did that but touch event is still not working :(
ram
Have you tried setting it on the cell too?
jtbandes
yes both side i did .. my touch event is not at all working in table cells its just working outside of cells
ram
+2  A: 

If you want to detect a touch on the UITableViewCell you don't really need to detect touch events. In your UITableViewController subclass, you need to implement the following delegate method:

- (void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)indexPath

Then you modify the image of the table cell for the selected index path.

Jergason