iOS 如何把view转成image

- (UIImage*) imageWithUIView:(UIView*) view

{

UIGraphicsBeginImageContext(view.bounds.size);

CGContextRef context = UIGraphicsGetCurrentContext();

[view.layer renderInContext:context];

UIImage* tImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return tImage;

}

注意:此方法不是线程安全的。使用时需注意!

你可能感兴趣的:(iOS 如何把view转成image)