UILabel末尾的虚线不受textColor的影响。
您可以在这里找到一个示例项目:https : //github.com/nverinaud/DottedLineBug。
涉及的代码如下:
- (IBAction)sliderValueChanged:(UISlider *)sender
{
UIColor *color = [UIColor colorWithHue:sender.value
saturation:1
brightness:1
alpha:1];
self.label.textColor = color;
}
这是显示问题的图片:
是否有人遇到相同的错误并找到了解决方法?
谢谢 !
使用NSAttributedString
确实有效。(感谢Andrea)。
这是一个例子:
- (IBAction)sliderValueChanged:(UISlider *)sender
{
UIColor *color = [UIColor colorWithHue:sender.value
saturation:1
brightness:1
alpha:1];
NSAttributedString *text = [[NSAttributedString alloc] initWithString:self.text attributes:@{ NSForegroundColorAttributeName : color }];
self.label.attributedText = text;
}
我确实向苹果报告了,这是报告ID :16470528
。
Apple已将其标记为的副本16443091
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句