3
換行符不適用於UIView的繪製?誰能幫忙?爲什麼當我在-drawRect中繪製一個字符串時,換行符不起作用?
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
UIFont * f = [UIFont systemFontOfSize:20];
[[UIColor darkGrayColor] set];
CGRect b = [self bounds];
NSString * text = @"hi \nr u";
CGSize sz = CGSizeMake(150,200);
CGContextScaleCTM(context, b.size.width/sz.width, b.size.height/sz.height);
[text drawAtPoint:CGPointMake(0,0) withFont:f];
}