2012年6月5日 星期二

文字顯示的應用

將下面的code放在drawRect下,就可以顯示文字了

UILabel* myLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];


UIFont *myfont = [UIFont fontWithName:@"Courier-Bold" size:22]; 
mylabel.font = myfont;

方法一
myLabel.text = @"Hello View 中文顯示";
[self addSubview:myLabel];

方法二
NSString *mytext = @"Hello, Mytext 測試中文"

[mytext drawAtPoint:CGPointMake(x, y) withFont:myfont];

在 iOS 中使用其他中文字型的方法 ref to http://furnacedigital.blogspot.tw/2011/03/ios.html


方法三:
使用CGContextShowText
但是不成功
參考網頁 http://fstoke.me/blog/?tag=mac
及Apple developer 的QuartzDemo皆不成功

卡在thread issue



 

沒有留言: