纯笔记类……希望喜欢:)
#import <QuartzCore/QuartzCore.h>
+ (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
支持视网膜:)
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
以上一段导致不支持透明背景( clear color),so,改成
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 0.0);
可行