法1:

UIGraphicsBeginImageContextWithOptions((view.bounds.size),NO , 0);//绘制出来的不模糊

// UIGraphicsBeginImageContext()//这种的绘制会模糊

CGContextRef ctx =UIGraphicsGetCurrentContext();

[view.layerrenderInContext:ctx];

UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

法2:

UIGraphicsBeginImageContextWithOptions((view.bounds.size), NO , 0);

[view drawRect:CGRectMake(0, 0, view.frameWidth, view.frameHeight)];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();