2013-08-06 27 views

Trả lời

9

Bạn có thể sử dụng [yourString drawAtPoint:aPoint withAttributes:dictOfAttributes];

Documents cho here đó.

Hoặc bạn chỉ có thể thêm UILabel vào phân cấp chế độ xem của mình.

2

// bắt đầu ngữ cảnh đồ họa 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(); 
Các vấn đề liên quan