我NSMutableAttributedString在iOS6中使用在UILabel子类中应用字距调整和阴影.正确应用属性,但是阴影在第一个字符的左边缘和下行部分的底部进行裁剪(例如小写的p).标签本身已clipsToBounds禁用.
代码...
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[self text]];
NSRange range = NSMakeRange(0, [attributedString length]);
NSNumber *kern = [NSNumber numberWithFloat:0.75f];
[attributedString addAttribute:NSKernAttributeName value:kern range:range];
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowBlurRadius:3.0f];
[shadow setShadowColor:[UIColor darkGrayColor]];
[shadow setShadowOffset:CGSizeMake(0, 2.0f)];
[attributedString addAttribute:NSShadowAttributeName value:shadow range:range];
[self setAttributedText:attributedString];
Run Code Online (Sandbox Code Playgroud)
它几乎没有引人注意,但一旦你看到它,它是显而易见的.有其他人遇到过这个bug并且有解决方法吗?