I add a attributed text in text view using code given bellow
NSString *string=[NSString stringWithFormat:@"<img src=\"%@\">",sticker.image_url];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[string dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
self.textView.attributedText=attrStr;
the textview has text testing <img src="www.google.com">
above code show image in text view. But now the problem is i want to get string and need to do some more work on it. Thats why when i try to get attributed string from text view using code given below then it only gives text not the html code that i added in the text view.
[self.textview.attributedString string]
return text = testing
Any help please. Acutally i want to show some images using html in text and then need to upload that code on server.
i am unable to understand where that html text goes away, it should stay be some where in the text but i am unable to get that text back Thanks in Advance
Once you convert html text to attributed string then you cannot get it back, I save a copy of text in 2nd variable for later use.