이미지가 셀에 있음을 알고 서브 클래 싱을 싫어하므로 조금 재미있는 해킹을 할 수 있습니다. 당신은 단지 cell.imageView 속성을 사용하고있는 UIImageView에 대한 범주 던져 수 있습니다
NSIndexPath indexOfSelectedCellImage = [self.tableview indexPathForCell:[notificaton object]];
내가 확인하지 않았다 : 테이블 뷰 컨트롤러에서 다음
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
if([self.superview isKindOfClass:[UITableViewCell class]]){
if([touches anyObject].tapCount == 1){
//Image was tapped, issue notification, we use the cell as the object
[[NSNotificationCenter defaultCenter] postNotificationName:@"CellImageTapped" object:self.superview]
//just return after the notification
return;
}
}
//if it wasn't a tap, just forward the touch
[super touchesEnded:touches withEvent:event];
}
을, 당신은에 의해 선택된 셀을 해결할 수 있습니다
…if([self.superview.superview isKindOfClass:[UITableViewCell class]])…
…[[NSNotificationCenter defaultCenter] postNotificationName:@"CellImageTapped" object:self.superview.superview]…
참고 : 바로 다음에 대체 할 경우에, 그러나 cell.imageView의 수퍼에서,있는 contentView 수 있습니다 테이블 뷰 컨트롤러가 notific에 가입해야해야합니다 ation.