需求如标题, 实现方法如下:
在didSelectRow中进行如下设置:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.selectedBackgroundView = [[UIView alloc]initWithFrame:cell.bounds];
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithHexString:@"0095d9"];
}
这样我们实现了第一个需求,在点击的时候,会显示自定义的颜色,而不是系统的颜色.
接下来实现第二个需求,在你请求完数据,进行reloadData之后, 添加如下方法:
[_mainTableView.mj_header endRefreshing];