Skip to content

Instantly share code, notes, and snippets.

@anil826
Created May 24, 2016 09:35
Show Gist options
  • Save anil826/1917fdd8d19eda930707d78e2b962a98 to your computer and use it in GitHub Desktop.
Save anil826/1917fdd8d19eda930707d78e2b962a98 to your computer and use it in GitHub Desktop.
differenct color in same lable using objective C
//AtrributedString for different color.
NSString *str = [NSString stringWithFormat:@"You Have Selected %@", treeModel.name];
NSMutableAttributedString *message = [[NSMutableAttributedString alloc] initWithString:str];
[message addAttribute: NSForegroundColorAttributeName value:[UIColor blackColor] range:[str rangeOfString:[NSString stringWithFormat:@"%@",treeModel.name]]];
cell1.descriptionLabel.attributedText = message;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment