0
我的UILabel被旋转这样的:为什么旋转UILabel无法渲染?
currentLabel.transform = CGAffineTransformMakeRotation(135/180 * M_PI);
我做出的UILabel作为imgViewToSave(这是一个的UIImageView)的子视图,只是将其保存为图片,在最后:
UIGraphicsBeginImageContextWithOptions(imgViewToSave.bounds.size, imgViewToSave.opaque, 0.0);
[imgViewToSave.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
但当图像被保存到照片时,我看不到已经旋转的UILabel,如果我不旋转UILabel,代码工作正常,UILabel将显示在图像中。
那么,为什么旋转的UILabel无法渲染?
Thx。
我试过[imgViewToSave.layer addSublayer:currentLabel.layer];但它仍然失败。而且我发现,如果旋转角度很小,它会显示,如果它很大,它不会显示。 – ArexChow
也许你必须增加rect以包含所有旋转的标签? – Mundi