【问题标题】:Creating and removing layer创建和删除图层
【发布时间】:2014-05-21 16:12:22
【问题描述】:

我这样创建图层

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;

我怎样才能删除它?

【问题讨论】:

    标签: ios imageview layer


    【解决方案1】:

    以与删除 UIView 对象相同的方式删除层

    for (CALayer *layer in imageView.layer.sublayers) {
        [layer removeFromSuperlayer];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      相关资源
      最近更新 更多