//开始图形上下文UIGraphicsBeginImageContext(imageSize);
//get the context for coreGraphics
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetTextDrawingMode(ctx, kCGTextFill);
[[UIColor blackColor] setFill];
[@"yourstring" drawAtPoint:CGPointMake(0, 0) withAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:17]}];
//make image out of bitmap context
UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10054 次 |
| 最近记录: |