【发布时间】:2014-02-24 10:37:50
【问题描述】:
我使用 UITextField 类中的 drawTextInRect: 方法来创建轮廓文本(带有黑色边框/存储效果的文本)。
但我需要类似的东西来在 UITextView 中创建相同的轮廓文本,但这里不包括 drawTextInRect: 方法。如何为 textView 执行此操作?
这是我在 UITextField 类中使用的代码:
- (void)drawTextInRect:(CGRect)rect {
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(c, 1);
CGContextSetLineJoin(c, kCGLineJoinRound);
CGContextSetTextDrawingMode(c, kCGTextFill);
self.textColor = [UIColor whiteColor];
[super drawTextInRect:rect];
CGContextSetTextDrawingMode(c, kCGTextStroke);
self.textColor = [UIColor blackColor];
[super drawTextInRect:rect];
}
如何在 UITextView 类中为 textView 创建类似的解决方案?
【问题讨论】:
标签: ios iphone ios7 uitextview