我正在创建一个应用程序,并希望使用一个UITextView和子类UITextView来概述文本。使用 aUILabel它可以使用下面的示例完成,但UITextView不提供drawTextinRect. 有没有人对如何在 a 中勾勒文本有任何建议UITextView?
- (void)drawTextInRect:(CGRect)rect
{
CGSize shadowOffset = self.shadowOffset;
UIColor *textColor = self.textColor;
CGContextRef context = UIGraphicsGetCurrentContext();
self.shadowOffset = CGSizeMake(0.0, 0.0);
CGContextSetLineWidth(context, [[self font] pointSize]/8.0);
CGContextSetTextDrawingMode(context, kCGTextStroke);
self.textColor = [UIColor blackColor];
[super drawTextInRect:rect];
CGContextSetTextDrawingMode(context, kCGTextFill);
self.textColor = textColor;
self.shadowOffset = CGSizeMake(0, 0);
[super drawTextInRect:rect];
self.shadowOffset = shadowOffset;
}