내가 정의 셀을 사용, 도청 된 세포 알고 이런 식으로 이미지가 체크 박스 (있는 UIImageView를) 정의 : 내가 사용의 TableView addGesture 내가 섹션에있는 tableView를 만들
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"cellIdentifier";
StandardCellWithImage *cell = (StandardCellWithImage *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
cell = [[StandardCellWithImage alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSeparatorStyleNone;
}
cell.checkbox.tag = indexPath.row;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didSelectedImageAtIndexPath:)];
tapGesture.numberOfTapsRequired = 1;
tapGesture.delegate = self;
[cell.checkbox addGestureRecognizer:tapGesture];
cell.checkbox.userInteractionEnabled = YES;
return cell;
}
그리고 didSelectedImageAtIndexPath의 방법 :
- (void) didSelectedImageAtIndexPath:(id) sender {
UITapGestureRecognizer *gesture = (UITapGestureRecognizer *) sender;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:gesture.view.tag inSection:0];
}
하지만이 섹션에는 사용자가이 행을 탭하는 것에 대한 지식이 없어도 여기에있는 행만 있습니다. 그것을 인식 할 가능성이 있습니까?
멋진 트릭 세르지오! 감사 – edzio27