We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用该方法public mutating func set(attributes: [Attribute], range: NSRange)设置字体颜色 在多个range的情况下只有最后一个生效
The text was updated successfully, but these errors were encountered:
等价于调用
func setAttributes(_ attrs: [NSAttributedString.Key : Any]?, range: NSRange)
你可以用
public mutating func add(attributes: [Attribute], range: NSRange) {
Sorry, something went wrong.
这个库,按照作者的回复,应该是基于 NSAttributedString,所以在确定range的时候,应该先将Swift.String转化成NSString。比如:
NSAttributedString
range
Swift.String
NSString
let length = "🤔".count let range = NSRange(location: 0, length: length)
应该改成:
let length = ("🤔" as NSString).length let range = NSRange(location: 0, length: length)
我脱机敲的,不知道准不准确。
或者可以用"🤔".utf8.count 等于 ("🤔" as NSString).length
No branches or pull requests
使用该方法public mutating func set(attributes: [Attribute], range: NSRange)设置字体颜色 在多个range的情况下只有最后一个生效
The text was updated successfully, but these errors were encountered: