ios的uitableview:实现不显示选中项颜色效果

版权声明: https://blog.csdn.net/henysugar/article/details/84315287

现象

uitablview点击一下后,还遗留选定的颜色效果,这在setting类似的界面中肯定是不好看的,

目标

希望能类似delphi里面列表控件有个hideselection一样,按下的时候看到反馈颜色,抬起的时候不要再显示颜色。

方法

方法原理是取消选定行的选定属性。

参考代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 // 在手指离开的那一刻进行反选中
 [tableView deselectRowAtIndexPath:indexPath animated:YES];
 }

本文结束。

猜你喜欢

转载自blog.csdn.net/henysugar/article/details/84315287