// Returns the current graphics context.This function may be called from any thread of your app.
CGContextRef context = UIGraphicsGetCurrentContext();
//当前视图的图片渲染到绘图context
[self.view.layer renderInContext:context];
//把图片绘制到当前context
CGContextDrawImage(context, CGRectMake(100, 100, 200, 200), image.CGImage);
//从当前context获取一个图片
UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
Creates a bitmap-based graphics context with the specified options.
UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.view.frame.size.width, self.view.frame.size.height), YES, UIScreen.mainScreen.scale);