I have table cells with an image on the left. Now, every time one taps the cell, the image changes, but I only want the image to change when the left area of the cell is tapped. How can I do this?
Right now I have:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
if (cell.imageView.image == [UIImage imageNamed:@"checkboxfull.png"]) {
cell.imageView.image = [UIImage imageNamed:@"checkboxblank.png"];
}
else if(cell.imageView.image == [UIImage imageNamed:@"checkboxblank.png"]) {
cell.imageView.image = [UIImage imageNamed:@"checkboxfull.png"];
//[alert show];
}
}
A table cell is just an
UIView. Make a custom cell and use aUIImageViewsubclass or a button that responds to your taps.Or use
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)eventof the table cell and compute the location.For information on table cells look here