UIView转UIimage
生活随笔
收集整理的這篇文章主要介紹了
UIView转UIimage
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/**
?將 UIView 轉換成 UIImage
?@param view 將要轉換的View
?@return 新生成的 UIImage 對象
?*/
- (UIImage *)yj_convertCreateImageWithUIView:(UIView *)view{
?? ?
??? UIGraphicsBeginImageContext(view.bounds.size);
??? CGContextRef ctx = UIGraphicsGetCurrentContext();
??? [view.layer renderInContext:ctx];
??? UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
??? UIGraphicsEndImageContext();
?? ?
??? return newImage;
}
總結
以上是生活随笔為你收集整理的UIView转UIimage的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【GPU精粹与Shader编程】(六)
- 下一篇: resin指定java版本_resin的