下面的示例应该与填充一起绘制笔触,但事实并非如此。怎么了?根据 Apple 的文档,我使用负值来显示 stoke。如果我将其设为正值,则文本将完全消失。
UITextView *rte = [[UITextView alloc]initWithFrame:
CGRectMake(50,50,100,100)];
[self.view addSubview:rte];
NSDictionary *typingAttributes = @{
NSFontAttributeName: [UIFont fontWithName:@"Helvetica-Bold" size:20.0f],
NSForegroundColorAttributeName : [UIColor redColor],
NSStrokeColorAttributeName : [UIColor yellowColor],
NSStrokeWidthAttributeName : [NSNumber numberWithFloat:-2.0]
};
NSAttributedString *str = [[NSAttributedString alloc]
initWithString:@"Enter text here..."
attributes:typingAttributes];
rte.attributedText = str;