eug*_*ene 9 iphone calayer uiimage
我有一个视图,其中包含内容为图像的子图层.
我希望通过myView.image获取视图的图像,但显然视图没有图像只是图层.
如何从视图的图层创建UIImage?
Max*_*Max 21
UIGraphicsBeginImageContext(yourView.bounds.size);
[yourView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
注意:您需要包含QuartzCore.