NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString length

Number:rdar://31034683 Date Originated:14-Mar-2017
Status:Open Resolved:
Product:iOS Product Version:10.3 beta 2 - 10.3 beta 5
Classification:UI/Usability Reproducible:Always

A strikethrough (single, double, ...) added as attribute to an instance of NSMutableAttributedString is not rendered if the apply range is not the whole string range. This happens using addAttribute(_ name: String, value: Any, range: NSRange),  insert(_ attrString: NSAttributedString, at loc: Int), append(_ attrString: NSAttributedString),, ...

Steps to Reproduce:
1. Create a NSMutableAttributedString
2. Add some text to it
3. Apply the strikethrough using NSMutableAttributedString attribute to a subrange of the string
4. Add the string to an UILabel

Expected Results:
The substring in the subrange targeted is rendered marked with a strikethrough

Actual Results:
The whole string is rendered without strikethrough

from 10.3 beta 2 to 10.3 beta 5

It's rendered properly with Xcode until 8.2 and on iOS devices with 10.2.x and previous version of iOS

iPhone 5S, iPhone 7+, iPad Air, Xcode playground Version 8.3 beta 4 (8W143q)

Playground (please use Xcode 8.3 beta):


substring in iOS xcode 10

the substring of NSMutableAttributedString not getting proper

By furkan.vijapura at Nov. 21, 2018, 10:25 a.m. (reply...)

Fixed in iOS11

iOS11 renders the result correctly

This also happens with subscript and superscript attributes.

This also happens with Xcode Version 8.3 (8E162) and iOS 10.3 release version.

By koenvanderdrift at April 2, 2017, 3:45 p.m. (reply...)

Added workaround

Workaround for specific scenarios can be found here: http://stackoverflow.com/questions/43074652/ios-10-3-nsstrikethroughstyleattributename-is-not-rendered-if-applied-to-a-sub

By roman.shevtsov at March 28, 2017, 4:12 p.m. (reply...)

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!