func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let radius = 8.0 //圆角
cell.backgroundColor = .clear
let normalLayer = CAShapeLayer()
let selectLayer = CAShapeLayer()
let bounds = cell.bounds.insetBy(dx:10.0, dy:0) //cell 左右缩进距离
let rowNum = tableView.numberOfRows(inSection: indexPath.section)
var bezierPath:UIBezierPath
if(rowNum==1) {
bezierPath = UIBezierPath(roundedRect: bounds, byRoundingCorners: .allCorners, cornerRadii:CGSize(width: radius, height: radius))
}else{
if(indexPath.row==0) {
bezierPath = UIBezierPath(roundedRect: bounds, byRoundingCorners:[UIRectCorner.topLeft,UIRectCorner.topRight], cornerRadii:CGSize(width: radius, height: radius))
UITableView cell加圆角
最新推荐文章于 2023-12-21 13:41:48 发布