iOS Develop

UITableView(I)

2018-11-30  本文已影响0人  Harely

消除选中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;
}



参考资料:

上一篇 下一篇

猜你喜欢

热点阅读