iOS 10.3: NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString(iOS 10.3:如果应用于 NSMutableAttributedString 的子范围,则不会呈现 NSStrikethroughStyleAttributeName)
问题描述
如果应用范围不是整个字符串范围,则不会呈现作为属性添加到 NSMutableAttributedString 实例的删除线(单、双...).
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.
使用 addAttribute(_ name: String, value: Any, range: NSRange), insert(_ attrString: NSAttributedString, at loc: Int), append(_attrString: NSAttributedString), ...
This happens using addAttribute(_ name: String, value: Any, range: NSRange), insert(_ attrString: NSAttributedString, at loc: Int), append(_ attrString: NSAttributedString), ...
在早期的 iOS 10.3 测试版中被 Apple 破坏,在 10.3 最终版中未修复.
Broken by Apple in early iOS 10.3 betas, and not fixed in 10.3 final.
信用:https://openradar.appspot.com/31034683
推荐答案
添加一个 NSBaselineOffsetAttributeName,如解释 here,属性字符串带回删除线.覆盖 drawText:in: 可能会很慢,尤其是在 Collection View 或 Table View Cells 上.
Adding a NSBaselineOffsetAttributeName, as explained here, to the attributed string brings back the strikethrough line. Overriding drawText:in: can be slow especially on Collection View or Table View Cells.
这篇关于iOS 10.3:如果应用于 NSMutableAttributedString 的子范围,则不会呈现 NSStrikethroughStyleAttributeName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS 10.3:如果应用于 NSMutableAttributedString 的子范围,则不会呈现 NSStrikethroughStyleAttributeName
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
