Ich habe diesen Code in meinen Händen:Wie mache ich einen Teil von NSMutableString fett?
if let text = trimText?.mutableCopy() as? NSMutableString {
text.insertString("\(prefix) ", atIndex: 0)
textStorage.replaceCharactersInRange(range, withString: text as String)
}
Wenn ich versuche, meine ändern text
wie:
text = attributedTextFunc(text)
wo
func attributedTextFunc(str: NSString) -> NSAttributedString {
var attributedString = NSMutableAttributedString(string: str as String, attributes: [NSFontAttributeName:UIFont.systemFontOfSize(15.0)])
let boldFontAttribute = [NSFontAttributeName: UIFont.boldSystemFontOfSize(15.0)]
attributedString.addAttributes(boldFontAttribute, range: str.rangeOfString("More"))
return attributedString
}
und ich bekomme diese Fehlermeldung:
Cannot assign value of type 'NSAttributedString' to type 'NSMutableString'
Wie kann ich es fett machen?
Ich verwende diese Bibliothek https://github.com/ilyapuchka/ReadMoreTextView, und ich möchte die zugeschnittene Textfarbe ändern und mach es fett. Aber ich kann nicht =/ – Doe
Ja, Sie sollten es in dieser Bibliothek tun. – Konstantin
@Doe Sie möchten einen fettgedruckten 'Read More' Text erstellen? –