나는 내 손에서이 코드를 가지고 : 나는 변경하려고하면NSMutableString의 일부분을 굵게 만드는 방법은 무엇입니까?
if let text = trimText?.mutableCopy() as? NSMutableString {
text.insertString("\(prefix) ", atIndex: 0)
textStorage.replaceCharactersInRange(range, withString: text as String)
}
을 내 text
같이
text = attributedTextFunc(text)
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
}
와 나는이 오류
Cannot assign value of type 'NSAttributedString' to type 'NSMutableString'
어떻게하면 과감하게 만들 수 있습니까?
이 함수의 반환 값을 할당하고, 나는 손질 텍스트 색상을 변경하려면 및 대담하게 만드십시오. 하지만 난 할 수 없어 =/ – Doe
예,이 라이브러리 안에서해야합니다. – Konstantin
@Doe 굵은'Read More' 텍스트를 만들고 싶습니까? –