删除button不显示UITableViewCell圆angular

在我的tableview中,我有我的tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)来确定,如果一个单元格的顶部,底部或根本没有圆angular的圆angular。

 override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { if indexPath.row == 0 { // round top 2 corners let maskLayer = CAShapeLayer() maskLayer.path = UIBezierPath(roundedRect: cell.bounds, byRoundingCorners: [UIRectCorner .TopLeft, UIRectCorner .TopRight], cornerRadii: CGSizeMake(4, 4)).CGPath cell.layer.mask = maskLayer } if indexPath.section != 1 { if indexPath.row == self.tableView.numberOfRowsInSection(indexPath.section) - 1 { let maskLayer = CAShapeLayer() maskLayer.path = UIBezierPath(roundedRect: cell.bounds, byRoundingCorners: [UIRectCorner .BottomLeft, UIRectCorner .BottomRight], cornerRadii: CGSizeMake(4, 4)).CGPath cell.layer.mask = maskLayer } } } 

这工作,但是我已经实现了编辑到桌面视图后,奇怪的事情发生在删除button。

用圆angular代码:

与圆角

当我删除圆angular时:

没有圆角

这真让我困惑,因为我不知道我做错了什么。 谁能帮忙?

 override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { if indexPath.row == 0 { // round top 2 corners let maskLayer = CAShapeLayer() maskLayer.path = UIBezierPath(roundedRect: cell.bounds, byRoundingCorners: [UIRectCorner .TopLeft, UIRectCorner .TopRight], cornerRadii: CGSizeMake(4, 4)).CGPath cell.contentView.layer.mask = maskLayer } if indexPath.section != 1 { if indexPath.row == self.tableView.numberOfRowsInSection(indexPath.section) - 1 { let maskLayer = CAShapeLayer() maskLayer.path = UIBezierPath(roundedRect: cell.bounds, byRoundingCorners: [UIRectCorner .BottomLeft, UIRectCorner .BottomRight], cornerRadii: CGSizeMake(4, 4)).CGPath cell.contentView.layer.mask = maskLayer } } } 

使用cell.contentView.layer.mask = maskLayer