0

I have tried to concatenate to attributed string with different properties,But not reflecting any changes,Here my code

//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];

I want to concatenate both attributedString2 attributedString3 into readingContent.What change required in my code?Please help me to resolve

Fazil
  • 1,390
  • 2
  • 13
  • 26
  • `readingContent.attributedText = [attributedString2 appendAttributedString:attributedString3];`? – Larme Nov 12 '14 at 15:03
  • @Larme Assigning to NSAttributedString from incompatible type void – Fazil Nov 13 '14 at 06:01
  • 1
    Sorry. `[attributedString2 appendAttributedString:attributedString3]; readingContent.attributedText = attributedString2;` – Larme Nov 13 '14 at 06:16

0 Answers0