objective-c draw 中文乱码问题

2011-04-07

之前使用 CGContextShowTextAtPoint 一直都是乱码

char *text  = "下载中";
CGContextShowTextAtPoint(context, 15.0, 15.0, [text UTF8String], strlen([text UTF8String]));
CGContextShowText(context, text, strlen(text));

折腾了大半天还是乱码。最后只好放弃。 最后改用,[NSString drawAtPoint:(CGPoint) withFont:(UIFont )] 问题解决,呵呵

NSString *text = @"下载中";
[text drawAtPoint:CGPointMake(10.0, 5.0) withFont:[UIFont fontWithName:@"Helvetica" size:10.0]];

注:以上必须在 .h文件中

#import