|
@@ -1243,13 +1243,19 @@
|
|
|
return [emailTest evaluateWithObject:checkString];
|
|
|
}
|
|
|
|
|
|
-+ (UIImage*)drawText:(NSString*)text inImage:(UIImage*)image atPoint:(CGPoint)point
|
|
|
-{
|
|
|
++ (UIImage*)drawText:(NSString*)text inImage:(UIImage*)image
|
|
|
+{
|
|
|
+ NSDictionary* attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:12], NSForegroundColorAttributeName:[UIColor whiteColor]};
|
|
|
+ NSAttributedString* attributedString = [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
|
|
+
|
|
|
+ int x = image.size.width/2 - attributedString.size.width/2;
|
|
|
+ int y = image.size.height/2-8;
|
|
|
+
|
|
|
UIGraphicsBeginImageContext(image.size);
|
|
|
[image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)];
|
|
|
- CGRect rect = CGRectMake(point.x, point.y, image.size.width, image.size.height);
|
|
|
+ CGRect rect = CGRectMake(x, y, image.size.width, image.size.height);
|
|
|
[[UIColor whiteColor] set];
|
|
|
- [text drawInRect:CGRectIntegral(rect) withAttributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:12], NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
|
|
+ [text drawInRect:CGRectIntegral(rect) withAttributes:attributes];
|
|
|
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
|
UIGraphicsEndImageContext();
|
|
|
|