问题描述:

i've a single UIButton to set the text bold and unbold in UITextview

 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

My question is how to unbold the selected text if it is already bold? how to check if the selectedRange is already bold or not?

相关阅读:
Top