无法删除子图层(swift)

时间:2016-09-08 11:34:05

标签: swift

 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
    var renderWidth:CGFloat = 8
    var renderYPosition:CGFloat = 22
    let cell = tableView.dequeueReusableCellWithIdentifier("idcell", forIndexPath: indexPath) as! UITableViewCell
   var bottomBorder = CALayer()
        bottomBorder.backgroundColor = (UIColor(red:1.00, green:0.90, blue:0.00, alpha:1.0).CGColor)
        bottomBorder.frame = CGRectMake(0, cell.frame.size.height-1 , cell.frame.size.width+800, 1)//#ffe500

        cell.layer.addSublayer(bottomBorder)
        cell.layer.removeFromSuperlayer()
}

即使我在addsublayer之后立即删除子层。它仍然出现了。如何删除刚刚添加的图层。

0 个答案:

没有答案