#pragma mark - 将文字添加到图片的方法实现
-(UIImage *) addText:(NSString *)someText toImage:(UIImage *)img
{
int w = img.size.width;
int h = img.size.height;
CGColorSpaceRef colorSpace =CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage);
char *text= (char *)[someText cStringUsingEncoding:NSASCIIStringEncoding];
CGContextSelectFont(context, "Arial",20, kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
//文字的颜色
CGContextSetRGBFillColor(context, 1, 0, 0, 1);
//文字的位置
CGContextShowTextAtPoint(context,10,10,text, strlen(text));
CGImageRef imgCombined = CGBitmapContextCreateImage(context);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
UIImage *retImage = [UIImage imageWithCGImage:imgCombined];
CGImageRelease(imgCombined);
return retImage;
}