【发布时间】:2018-05-23 11:34:57
【问题描述】:
我想把最后一个UITableViewCell底角做成圆形,我可以做到,但结果是没有正确绘制边界,任何人都对此类问题有相同的经验,请帮助我。谢谢
cell.roundCorners([.bottomLeft, .bottomRight], radius: 8)
cell.clipsToBounds = true
cell.layer.masksToBounds = true
cell.layoutSubviews()
【问题讨论】:
-
你在哪里调用这个代码?
-
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { let numberOfRows = tableView.numberOfRows(inSection: indexPath.section) if numberOfRows - 1 == indexPath.row { cell.roundCorners([.bottomLeft, .bottomRight], radius: 8) cell.layoutSubviews() } }
-
在 willDisplayCell 中调用它,如果您有任何建议,请告诉我
-
您是否提供了相同的边框颜色和宽度?
-
如果我要提供边框颜色,我必须设置边框宽度,在这种情况下,单元格的所有四个边框都会被着色并且看起来很奇怪,因为,我正在为 uitableview 使用分隔符