Skip to content

Instantly share code, notes, and snippets.

@AdiletAbylov
Last active August 29, 2015 14:07
Show Gist options
  • Save AdiletAbylov/558977f43d856b8cf601 to your computer and use it in GitHub Desktop.
Save AdiletAbylov/558977f43d856b8cf601 to your computer and use it in GitHub Desktop.
NSTextAttachment *attachment = [NSTextAttachment new];
attachment.image = [[UIImage imageNamed:@"iconBookmarkhint.png"] resizedImageToFitInSize:(CGSize){10,10} scaleIfSmaller:YES];
NSMutableAttributedString *imageAttrString = [[NSAttributedString attributedStringWithAttachment:attachment] mutableCopy];
NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc] initWithString:@"To save a chat message, tap and hold the message and use the"
attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:13],
NSForegroundColorAttributeName : [UIColor blackColor]}];
NSAttributedString *attributedString2 = [[NSAttributedString alloc] initWithString:@"button"
attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:13],
NSForegroundColorAttributeName : [UIColor blackColor]}];
[attributedString1 appendAttributedString:imageAttrString];
[attributedString1 appendAttributedString:attributedString2];
self.label.text = nil;
self.label.attributedText = attributedString1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment