【发布时间】:2018-10-12 16:52:49
【问题描述】:
ViewController.swift
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "mycell") as! CustomTableViewCell
cell.backgroundColor = UIColor.clear
cell.nameLbl.text = "\(adminNmaes[indexPath.row])"
cell.aboutLbl.text = "\(aboutarray[indexPath.row])"
if indexPath.row == 0
{
cell.view1.roundCorners(corners: [.topLeft,.topRight], radius: 10)
// tableView.reloadData()
}
return cell
}
extension UIView {
func roundCorners(corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
layer.mask = mask
}
}
我使用自动布局设置自定义单元格类,并使用扩展程序仅对第一个单元格应用角半径。我还想为页脚的左下角和右下角提供圆角半径,并将其填充为 10。感谢任何帮助。提前致谢。
【问题讨论】:
标签: ios swift xcode uitableview