I want to include png image in between my text of a label. how to proceed with this in objective-c.
1 Answer
This is the answer in case someone find it useful----->
NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; attachment.image = [UIImage imageNamed:@"Attach-52.png"]; NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment]; NSMutableAttributedString *myString= [[NSMutableAttributedString alloc] initWithString:@"My label text"]; [myString appendAttributedString:attachmentString]; myLabel.attributedText = myString; Likewise you can add png image through NSAttributedString.