5
我有一个自定义UILabel与圆角和阴影。我使用CALayer上的属性来实现这一点。接下来,我试图将这个保存为使用renderInContext:的UIImage。圆角保持不变,但出现黑色背景并且投影阴影松散。可以renderInContext:保持角半径和阴影?
上呈现的UILabel为图像,但保持阴影和圆角有什么想法?
下面是我使用呈现标签的代码:
UIGraphicsBeginImageContextWithOptions(label.bounds.size, YES, 0);
[label.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();