您的当前位置:首页正文

UITableView(I)

来源:图艺博知识网

消除选中cell的效果

在数据源协议代理方法:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;中对cell进行初始化时,设置这个属性:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"commentCell"];
        if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"commentCell"];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;//设置这个属性
          }
      return cell;
}



参考资料:

Top