Is there a replace method for NSMutableAttributedString
similar to stringByReplacingOccurrencesOfString:
for NSString
?
NSString *newString = [myString stringByReplacingOccurrencesOfString:@"," withString:@""];
I need the same method for NSMutableAttributedString
. (I need replace string with image).
NSMutableAttributedString *mutableAttString = [[NSMutableAttributedString alloc] init];
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"a.png"];
NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
[mutableAttString replaceCharactersInRange:getanswer
withAttributedString:attachmentString];
this way only replace one time. i need quantities replace