writingDirection这里原文[https://developer.apple.com/documentation/foundation/nsattributedstring/key/1524497-writingdirection]描述:
The value of this attribute is an NSArray object containing NSNumber objects representing the nested levels of writing direction overrides, in order from outermost to innermost.
这里应该是一个NSNumber的数组,代码修改如下:
let dict = [NSAttributedStringKey.writingDirection:[index]]
let attrStr = NSMutableAttributedString.init(string: self.titleStr, attributes: dict)
label.attributedText = attrStr
writingDirection这里原文[https://developer.apple.com/documentation/foundation/nsattributedstring/key/1524497-writingdirection]描述:
The value of this attribute is an NSArray object containing NSNumber objects representing the nested levels of writing direction overrides, in order from outermost to innermost.
这里应该是一个NSNumber的数组,代码修改如下:
let dict = [NSAttributedStringKey.writingDirection:[index]]
let attrStr = NSMutableAttributedString.init(string: self.titleStr, attributes: dict)
label.attributedText = attrStr