//个性化点击效果
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSelector:@selector(deselect) withObject:nil afterDelay:0.2f];
}
-(void)deselect{
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSelector:@selector(deselect) withObject:nil afterDelay:0.2f];
}
-(void)deselect{
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
//============系统样式===================
self.selectionStyle
=
UITableViewCellSelectionStyleDefault;
/**
* UITableViewCellSelectionStyleNone,//没有现象
UITableViewCellSelectionStyleBlue, 灰色
UITableViewCellSelectionStyleGray,
UITableViewCellSelectionStyleDefault
*/
/**
* UITableViewCellSelectionStyleNone,//没有现象
UITableViewCellSelectionStyleBlue, 灰色
UITableViewCellSelectionStyleGray,
UITableViewCellSelectionStyleDefault
*/
本文介绍如何实现个性化点击效果并优化系统的样式,在TableView中通过特定代码实现在选择和取消选择时的不同表现,包括调整选择样式为无、蓝色、灰色或默认样式。
4160

被折叠的 条评论
为什么被折叠?



