gpt4 book ai didi

iOS 10.3 : NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString

转载 作者:IT王子 更新时间:2023-10-29 05:00:04 26 4
gpt4 key购买 nike

如果应用范围不是整个字符串范围,则不会呈现作为属性添加到 NSMutableAttributedString 实例的删除线(单、双、...)。

这发生在使用 addAttribute(_ name: String, value: Any, range: NSRange), insert(_ attrString: NSAttributedString, at loc: Int), append(_ attrString: NSAttributedString), ...

在早期的 iO​​S 10.3 测试版中被 Apple 破坏,在 10.3 final 中没有修复。

信用: https://openradar.appspot.com/31034683

最佳答案

设置基线偏移似乎可以解决这个问题:

[attributedStr addAttribute:NSBaselineOffsetAttributeName value:@0 range:NSMakeRange(0, 10)];
[attributedStr addAttribute:NSStrikethroughStyleAttributeName value:@2 range:NSMakeRange(0, 10)];

这是一个已知的 bug在 iOS 10.3 中

关于iOS 10.3 : NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43074652/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com