创建和删除图层

时间:2014-05-21 16:12:22

标签: ios imageview layer

我像这样创建图层

imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = imageView.frame.size.height / 2;
imageView.layer.borderColor = kBGColor.CGColor;
imageView.layer.borderWidth = 2.0f;
imageView.layer.rasterizationScale = [UIScreen mainScreen].scale;
imageView.layer.shouldRasterize = YES;
imageView.clipsToBounds = YES;

如何删除它?

1 个答案:

答案 0 :(得分:1)

删除图层的方式与删除UIView个对象

的方式相同
for (CALayer *layer in imageView.layer.sublayers) {
    [layer removeFromSuperlayer];
}