2013-08-06 38 views

回答

9

您可以使用[yourString drawAtPoint:aPoint withAttributes:dictOfAttributes];

文档为here

或者您可以将UILabel添加到您的视图层次结构中。

2

//开始图形上下文 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(); 
相关问题