iPhone UITableView cells stay selected

前端 未结 7 1242
[愿得一人]
[愿得一人] 2020-12-28 11:50

in my UITableView sometimes cells stay selected after touching. Because it happens only occasionally, I\'m not able to reproduce the problem.

Any hints? Maybe it has

7条回答
  •  孤独总比滥情好
    2020-12-28 12:35

    Use this method in your UITableViewCell class

    (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    // Just comment This line of code
    
    // [super setSelected:selected animated:animated];
    
    }
    

    or even you can try this code in didSelectRowAtIndexPath method

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     
      // Do some stuff when the row is selected

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    

    }

提交回复
热议问题