UIButton 및 UIImageView가있는 사용자 지정 UITableViewCell이 있습니다. UITableViewDelegate의 tableView:didSelectRowAtIndexPath:
메서드 외부의 닿기를 처리하기 위해 UIButton 및 UIImageView 개체를 원합니다.UITableViewCell 내부에서 별도의 핸들 처리
@implementation CustomTableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// handle cell selected
}
@end
내있는 UITableViewCell :은 buttonClicked 및 imageClicked 대신 컨트롤러의 didSelectRowAtIndexPath
의
@implementation CustomTableViewCell
- (id)init {
[button addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
[image addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageClicked)]];
[image setUserInteractionEnabled:YES];
}
/*
* I want these to be called instead of tableView:didSelectRowAtIndexPath:
* when the button or image are tapped and I want
* tableView:didSelectRowAtIndexPath: to be called when any other part of
* the cell is tapped.
*/
- (void)buttonClicked {
// not called
}
- (void)imageClicked {
// not called
}
@end
를 호출 할 어떻게합니까?