开发者

BackgroundColor + image of UIImageView to UIImage

开发者 https://www.devze.com 2023-02-01 09:48 出处:网络
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 whi

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];

0

精彩评论

暂无评论...
验证码 换一张
取 消