Dad*_*ido 5 iphone objective-c ios ios7
我在iOS 7中遇到了一个奇怪的错误,我把它称为"错误".
摘要:
两个字符"fi"被视为一个字符.
说明:
我创建了一个带有单词的UILabel作为属性文本.我创建了一个函数,在单击颜色时,该字的一个字符为蓝色.(即首先点击它为第一个字符着色,然后从第一个字符到第二个字体再次点击颜色......).
使用iOS 6模拟器没有任何问题,当我们切换到iOS 7模拟器时,只要单词上不包含"fi",一切都很好.例如,当我写"金融"时,从第一次点击开始,f和i都用蓝色着色.
它不依赖于'fi'位置,并且似乎只有'fi'才有问题.
码:
UILabel:
@property (strong, nonatomic) IBOutlet UILabel *wordLabel;
着色功能:
- (void) changeWordLabelWithWord:( NSString *)word to:(int) position{
NSMutableAttributedString *coloredText = [[NSMutableAttributedString alloc] initWithString:word];
[coloredText addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0.25 green:0.66 blue:0.96 alpha:1] range:NSMakeRange(0,position)];
_wordLabel.attributedText = coloredText;
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助和见解^^.
干杯!
| 归档时间: |
|
| 查看次数: |
922 次 |
| 最近记录: |