I have a very strange requirement. Custom images needs to inserted with texts in UILabel. My first question is this possible in UILabel. I can see emojis can be fitted there because they are unicodes however custom images are pure images so how to add images and text at the same time.
STextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"myimage.png"];
NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
NSMutableAttributedString *myString = [[NSMutableAttributedString alloc] initWithString:@"My label text"];
[myString appendAttributedString:attachmentString];
myLabel.attributedText = myString;
I did this however this is not happening in runtime like I want to give user option to use icon/sticker and text simultaneously.