I made a NSMutableAttributedString object which consists of 2 different NSMutableAttributedString objects:
NSMutableAttributedString * ob1 = [[NSMutableAttributedString alloc] initWithString:@"Headline"];
[ob1 addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial" size:25.0] range:NSMakeRange(0,8)];
[ob1 addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0] range:NSMakeRange(0,8)];
NSMutableAttributedString * ob2 = [[NSMutableAttributedString alloc] initWithString:@"Test"];
[ob2 addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial" size:25.0] range:NSMakeRange(0,4)];
[ob2 addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0.3 green:0.3 blue:0.0 alpha:1.0] range:NSMakeRange(0,4)];
[ob1 appendAttributedString:ob2];
self.aUITextViewObj.attributedText = ob1;
My Problem is: The text is displayed accurate almost everytime in the UITextView. But sometimes its font size becomes bigger. It's totally by accident, there seems to be no rule. The same text which is displayed correct is displayed too big the next time. What i figured out:
- Problem doesn't appear in the Simulator.
- On an iPhone 4(iOS 6.1.3) it appears about 90% of the time. On iPhone 5 (iOS 6.1.4)/IPad (iOS 6.1.3) it happens about 10% of the time.