直接上代码
UIImage *image = [UIImage imageNamed:@"123"];
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
layer.contents = (__bridge id _Nullable)(image.CGImage);
[self.view.layer addSublayer:layer];
__bridge 是无缝桥接技术,它告诉ARC如何处理转换所涉及的Objective-C对象