扫码关注官方订阅号
点击Cell是被选中的cell的背景会是灰色的,怎样取消Cell 的选中状态?
走同样的路,发现不同的人生
只需要在- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath中加入一行代码就可以了[tableView deselectRowAtIndexPath:indexPath animated:YES]; 然后再写你其他代码就可以了
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
[tableView deselectRowAtIndexPath:indexPath animated:YES];
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES];// 取消选中 //其他代码 }
设置cell的选中属性为如下就没有点击效果了 cell.selectionStyle = UITableViewCellSelectionStyleNone;
加入iOS技术大神群 QQ群号:149615208
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
只需要在
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath中加入一行代码就可以了[tableView deselectRowAtIndexPath:indexPath animated:YES];然后再写你其他代码就可以了设置cell的选中属性为如下就没有点击效果了
cell.selectionStyle = UITableViewCellSelectionStyleNone;
加入iOS技术大神群 QQ群号:149615208