iOS 10.3:如果应用于 NSMutableAttributedString 的子范围,则不会呈现 NSStrikethroughStyleAttributeName

iOS 10.3: NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString(iOS 10.3:如果应用于 NSMutableAttributedString 的子范围,则不会呈现 NSStrikethroughStyleAttributeName)
本文介绍了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), ...

在早期的 iO​​S 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
Dropbox Files.download does not start when number of files in folder is gt; 1000(当文件夹中的文件数为1000时,Dropbox Files.Download不会启动)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)