【发布时间】:2011-03-12 16:58:51
【问题描述】:
我遇到了 NSString drawInRect 方法的问题。 我有一个非常大的文本要绘制在 768x1024 大小的 Rect 上,我得到了这个:
你可以看到唯一到达整个屏幕的文本行是最后一个,我不知道为什么其他行没有。 这是我的代码:
//The drawing rectangle
CGRect textRect = CGRectMake(1, 4, 768, 1024);
[[UIColor blackColor] set];
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
//texto_completo is a very large text String
[texto_completo drawInRect:textRect withFont:font lineBreakMode:UILineBreakModeCharacterWrap alignment:UITextAlignmentLeft];
CGImageRef cgImage = CGBitmapContextCreateImage(context);
UIImage *img_con_texto = [[UIImage alloc] initWithCGImage:cgImage];
UIGraphicsPopContext();
CGContextRelease(context);
CGImageRelease(cgImage);
您能帮我理解这种行为吗?
【问题讨论】:
标签: iphone cocoa-touch text nsstring