How to give space between two cells in tableview?

前端 未结 26 1530
谎友^
谎友^ 2020-11-29 00:11

I want a space between two cell in table view,

I want cell like this,

\"enter<

26条回答
  •  醉话见心
    2020-11-29 00:59

    Add these lines in the cellForRowAtIndexPath UITableViewDelegate method before returning the cell.

    let separator = UIView(frame: CGRectMake(0, 0, cell!.bounds.size.width, 1))
    separator.backgroundColor = UIColor.whiteColor()
    cell.contentView.addSubview(separator)
    

提交回复
热议问题