I have a UIImageView
with some lines (drawed by hand) and a background color. When i pu开发者_JS百科t the image of the UIImageView
into a UIImage
and save it to the photo library the background is white again. Is there any way to put the image property and the backGroundColor
property of a UIImageView
into one UIImage
?
It is possible to render the contents of an arbitrary UIView to an UIImage.
See http://www.icab.de/blog/2010/10/01/scaling-images-and-creating-thumbnails-from-uiviews/ for an implementation.
At the bottom of that page is a category for UIImage which, when imported, simply lets you create the UIImage
from the UIView
with UIImage *img = [UIImage imageFromView:someView];
精彩评论