File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,17 +155,18 @@ - (UIImage *)imageSnapshotFromText:(NSString *)text backgroundColor:(UIColor *)c
155155 //
156156 // Draw text in the context
157157 //
158- CGSize textSize = [text sizeWithAttributes: @{NSFontAttributeName :[self fontForText: fontName]}];
158+ NSDictionary *textAttributes = @{
159+ NSFontAttributeName :[self fontForText: fontName],
160+ NSForegroundColorAttributeName :[UIColor whiteColor ]
161+ };
162+ CGSize textSize = [text sizeWithAttributes: textAttributes];
159163 CGRect bounds = self.bounds ;
160164
161165 [text drawInRect: CGRectMake (bounds.size.width/2 - textSize.width/2 ,
162166 bounds.size.height/2 - textSize.height/2 ,
163167 textSize.width,
164168 textSize.height)
165- withAttributes: @{
166- NSFontAttributeName :[self fontForText: fontName],
167- NSForegroundColorAttributeName :[UIColor whiteColor ]
168- }];
169+ withAttributes: textAttributes];
169170
170171 UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext ();
171172 UIGraphicsEndImageContext ();
You can’t perform that action at this time.
0 commit comments