well there is the
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)in开发者_Python百科dexPath
but this is for the cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
How can i catch a clickevent on the cell.Image?
UIImage view does not decsend from UIControl that's why it does not have Touchepinside like target action method. So what I guess you can do is Create a UIButton object. Then set an image for it's normal state:
[imageButton setImage:[UIImage imageNamed:@"Icon.png"]
forState:UIControlStateNormal];
Then set it's target action:
[imageButton addTarget:self action:@selector(buttonPushed:)
forControlEvents:UIControlEventTouchUpInside];
And then :
[cell.contentView addSubview:imageButton];
I guess that'll do the job.
精彩评论