iOS 叠加不规则的图片

- (void)createMaskWithColor:(UIColor *)color {

UIImageView *maskImageView = [[UIImageView alloc]initWithFrame:self.bounds];

maskImageView.backgroundColor = [UIColor whiteColor];

maskImageView.layer.shadowOpacity = 0.5f;

// 叠加的图片

maskImageView.image = image

maskImageView.alpha = 0.7;

[self addSubview:maskImageView];

CALayer *contentImageView = [CALayer layer];

contentImageView.frame = self.bounds;

// 图片的模型

contentImageView.contents = (__bridge id)image.CGImage;

maskImageView.layer.mask = contentImageView;

}

你可能感兴趣的:(iOS 叠加不规则的图片)