NSUnderlineStyleAttributeName and NSStrikethroughStyleAttributeName don't work when used in conjunction with appendAttributedString
| Originator: | oliverpearmain | ||
| Number: | rdar://18409995 | Date Originated: | 09/22/2014 |
| Status: | Resolved: | ||
| Product: | Product Version: | ||
| Classification: | Reproducible: |
Summary:
With iOS 7 it was possible to define an NSMutableAttributedString that was PART underlined and/or PART struck-through and this would display appropriately. However the exact same code does not render correctly in iOS 8, the underlining and/or strike-through is lost.
Steps to Reproduce:
Try the following sample code:
NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedString alloc] init];
NSDictionary *complex1LabelAttributes = @{ NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle),
NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle) };
NSAttributedString *complex1LabelAttributedString = [[NSAttributedString alloc] initWithString:@"complex" attributes:complex1LabelAttributes];
[mutableAttributedString appendAttributedString:complex1LabelAttributedString];
NSDictionary *complex2LabelAttributes = @{ NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle),
NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle) };
NSAttributedString *complex2LabelAttributedString = [[NSAttributedString alloc] initWithString:@"label" attributes:complex2LabelAttributes];
[mutableAttributedString appendAttributedString:complex2LabelAttributedString];
self.complexLabel.attributedText = mutableAttributedString;
Expected Results:
I expect to see the label with the word 'complex' without any underlining or strike-through but the word 'label' WITH both underlined and a strike-through.
Actual Results:
The word 'label' is NOT underlined or struck-through.
Version:
8.0 (12A365)
Notes:
Configuration:
iOS8 iPhone Simulator or iOS8 iPhone or iPad
Attachments:
'IOS7.png' and 'IOS8.png' were successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!