스크롤 뷰가있는 솔루션에서는 스크롤 뷰에서 스크롤 할 수 없으므로 gestureRecognizer가 터치를 '가져옵니다'. 그래서 저는 scrollview를 전혀 사용하지 않을 것입니다.
레이블이 같은 내용에 크기를 조정합니다 :
CGSize customTextLabelSize = [cell.customTextLabel.text sizeWithFont:cell.customTextLabel.font constrainedToSize:CGSizeMake(cell.customTextLabel.frame.size.width, 999999)];
cell.customTextLabel.frame = CGRectMake(cell.customTextLabel.frame.origin.x, cell.customTextLabel.frame.origin.y, cell.customTextLabel.frame.size.width, customTextLabelSize.height);
또한 heightForRowAtIndexPath
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
CGSize cellSize = [bigTextString sizeWithFont:customTextLabel.font constrainedToSize:CGSizeMake(generalCellWidth, 999999)];
return cellSize.height;
}
에 그냥 didSelectRowAtIndex 방법을 사용할 수있는이 방법이 구현해야합니다. 방법 :
당신이 정말로는있는 ScrollView를 사용 cellForRowAtIndexPath에서 셀에 버튼을 추가하려면
. 셀만큼 큰 버튼을 확인하고이 같은 버튼 태그를 추가
UIButton *cellButton = [UIButton buttonWithType:UIButtonTypeCustom];
cellButton.frame = CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height);
cellButton.tag = indexPath.row;
[cellButton addTarget:self action:@selector(cellButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:cellButton];
그런 다음 추가 :
-(void)cellButtonAction:(UIButton*)sender
{
//do something with sender.tag
}