我有一个带有标识符的自定义单元格的UITableView。使用原型单元格部分中的界面构建器添加样式。
开始时单元格样式符合预期:
但是,当用户点击任何一个单元格时,以下情况发生在底部的第三个单元格中:
备注
以下示例
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Team *team = [[teams objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TeamCell" forIndexPath:indexPath];
UILabel *teamName = (UILabel *)[cell viewWithTag:10];
UIImageView *teamImage = (UIImageView *)[cell viewWithTag:20];
UISwipeGestureRecognizer *gestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeHandler:)];
[gestureRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft)];
[cell addGestureRecognizer:gestureRecognizer];
cell.tag = indexPath.section * team_index_modular + indexPath.row;
teamName.text = team.team_name;
[teamImage sd_setImageWithURL:[NSURL URLWithString:team.team_image]];
if (selected_index == indexPath.row && selected_section == indexPath.section)
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}