- (UIImage *) addTextToImage:(UIImage *) baseImage text:(NSString *)text atRect:(CGRect) rect{
int w = baseImage.size.width;
int h = baseImage.size.height;
UIGraphicsBeginImageContext(baseImage.size);
[[UIColor redColor] set];
[baseImage drawInRect:CGRectMake(0, 0, w, h)];
[text drawInRect:rect withFont:[UIFont systemFontOfSize:20]];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
int w = baseImage.size.width;
int h = baseImage.size.height;
UIGraphicsBeginImageContext(baseImage.size);
[[UIColor redColor] set];
[baseImage drawInRect:CGRectMake(0, 0, w, h)];
[text drawInRect:rect withFont:[UIFont systemFontOfSize:20]];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}