WatchKit label doesn't resize correctly for certain attributed strings
| Originator: | futuretap | ||
| Number: | rdar://22817797 | Date Originated: | 23-Sep-2015 01:27 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | watchOS 2 |
| Classification: | UI/Usability | Reproducible: | Always |
A WKInterfaceLabel in a group with insets configured as "Size To Fit Content" in both dimensions with multi line text (Lines = 0) sometimes truncates the text instead of resizing the label.
This incorrectly truncates the text on the 38 mm watch:
aString = [[NSMutableAttributedString alloc] initWithString:@"★\u200B★\u200B★\u200B½\u200B☆" attributes:@{NSBaselineOffsetAttributeName: @(0), NSFontAttributeName: [UIFont systemFontOfSize:11]}];
[aString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@" 106 ratings"]];
[self.testLabel setAttributedText:aString];
This doesn't:
aString = [[NSMutableAttributedString alloc] initWithString:@"★\u200B★\u200B★\u200B½\u200B☆" attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:11]}];
[aString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@" 106 ratings"]];
[self.testLabel2 setAttributedText:aString];
The difference is the presence of NSBaselineOffsetAttributeName = 0 in the first version. See the attached screenshot.
This is a regression from watchOS 1.x.
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!