我试着NSMutableAttributedString
用这段代码来设计我的字体:
NSMutableAttributedString* attString = [[NSMutableAttributedString alloc] initWithString:element04.text];
NSRange range = NSMakeRange(0, [attString length]);
[attString addAttribute:NSFontAttributeName value:element04.font range:range];
[attString addAttribute:NSForegroundColorAttributeName value:element04.textColor range:range];
NSShadow* shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor colorWithRed:30/255 green:11/255 blue:0/255 alpha:1];
shadow.shadowOffset = CGSizeMake(2.0f, 2.0f);
[attString addAttribute:NSShadowAttributeName value:shadow range:range];
[attString addAttribute:NSStrokeColorAttributeName value:[UIColor colorWithRed:30/255 green:11/255 blue:0/255 alpha:1] range:range];
[attString addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithFloat:-2.0] range:range];
element04.attributedText = attString;
这里的问题是阴影处有边界。如何使用没有边框的阴影为文本添加边框?