Fork me on GitHub

如何用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后,问题不存在了。

posted on 2012-04-21 13:06  pengyingh  阅读(878)  评论(0)    收藏  举报

导航