我在UITextview中使用单个UIButton设置粗体和非粗体文本
let range = mainTextView.selectedRange
let string = NSMutableAttributedString(attributedString: mainTextView.attributedText)
let attributes = [NSFontAttributeName: UIFont.boldSystemFontOfSize(12)]
string.addAttributes(attributes, range: mainTextView.selectedRange)
mainTextView.attributedText = string
我的问题是,如果选定的文字已经加粗,如何展开?如何检查selectedRange是否已加粗?