0

異なるプロパティを持つ属性付き文字列に連結しようとしましたが、変更を反映していません。ここに私のコード

//White color

NSMutableAttributedString *attributedString2 = [[NSMutableAttributedString alloc] initWithData:[[NSString stringWithFormat:@"%@",readingPartCntnt] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
[attributedString2 addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, attributedString2.length)];
[attributedString2 addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString2.length)];

//Blue color

NSMutableAttributedString *attributedString3 = [[NSMutableAttributedString alloc] initWithData:[[NSString stringWithFormat:@"%@",readingFootCntnt] dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
[attributedString3 addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:(154.0/255.0) green:(224.0/255.0) blue:(250.0/255.0) alpha:1.0] range:NSMakeRange(0, attributedString3.length)];
[attributedString3 addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString3.length)];
 //UITextview
 readingContent.attributedText = [NSMutableAttributedString attributedStringWithAttachment:attributedString2,attributedString3];

両方のattributedString2 attributedString3を readingContentに連結したいのですが、コードにどのような変更が必要ですか?解決を手伝ってください

4

0 に答える 0