- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
HomePageTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backView.backgroundColor = [UIColor lightGrayColor];
return YES;
}
- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath {
HomePageTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backView.backgroundColor = [UIColor whiteColor];
}
在这两个代理方法中我们可以设置点击时的颜色和离开cell时的颜色。
tableView的代理方法中cell的按下和离开
最新推荐文章于 2019-12-11 11:28:51 发布