如何用drawInRect()显示中文?
http://bbs.weiphone.com/read-htm-tid-95491.html
我的代码做了如下:
NSString* sCands = [NSString stringWithUTF8String:"欢迎"];
//struct __GSFont * font=[NSClassFromString(@"WebFontCache") createFontWithFamily:@"STHeiti" traits:2 size:18.];
//struct __GSFont * font=GSFontCreateWithName("Helvetica", kGSFontTraitBold,18);
struct __GSFont * font=GSFontCreateWithName("STHeiti", kGSFontTraitBold,18);
[sCands drawInRect:_rectCand withFont:font];
搞定了,使用stringWithFormat后,问题不存在了。

浙公网安备 33010602011771号