赞
踩
此文是按照原文整理直接拷贝代码使用
原文出处原文出处
此方法针对没有头尾的情况,如果带有头尾请查看原作者另一篇文章
带有头尾的section圆角
开发中常用到cell两边带有边距和圆角,如果section里有多个cell,直接设置圆角会出问题,此文把两种情况总结为一个方法,在 cellForRow
或 willDisplayCell
方法里直接调用即可
private func setCornerRadiusForSectionCell(cell: UITableViewCell, indexPath: IndexPath) {
//圆角半径
let cornerRadius:CGFloat = 10.0
//下面为设置圆角操作(通过遮罩实现)
let sectionCount = tableView.numberOfRows(inSection: indexPath.section)
let shapeLayer = CAShapeLayer
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。