How to customize tableView separator in iPhone

前端 未结 12 1978
夕颜
夕颜 2020-11-28 20:49

By default there is a single line separator in uitableview.

But I want to put my customized line as a separator.

Is it possible? How?

12条回答
  •  借酒劲吻你
    2020-11-28 21:30

    A better solution is to use the cell's current width and height. Something like this:

    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, cell.contentView.frame.size.height - 1.0, cell.contentView.frame.size.width, 1)];
    
    lineView.backgroundColor = [UIColor darkGrayColor];
    [cell.contentView addSubview:lineView];
    

提交回复
热议问题