I have an attributedString with image attachments on it, and I need to insert text to it without removing the images. The first thing that I'm doing is detecting at what indexes the images are currently attached.
Below is the code that I'm using, but it is not working all of the time, maybe there is a better way?
char charTemp;
for(int i = 0; i < [mutableAttStr.string length]; i++){
charTemp = [mutableAttStr.string characterAtIndex:i];
if (!isalpha(charTemp) && !isspace(charTemp) && !iscntrl(charTemp) && !ispunct(charTemp)) {
// NSLog(@"isAttachment");
[attachmentArrayCharIndex addObject:[NSNumber numberWithInt:i]];
}
}