Skip to content

Instantly share code, notes, and snippets.

@Quaggie
Created January 16, 2017 16:18
Show Gist options
  • Save Quaggie/aac43d8a443e87bdbfd9ace5027a828f to your computer and use it in GitHub Desktop.
Save Quaggie/aac43d8a443e87bdbfd9ace5027a828f to your computer and use it in GitHub Desktop.
// ...
@property (weak, nonatomic) IBOutlet UITextView *thankYoutTextView;
// ...
// thankYouTextView
NSString *userName = [[PFUser currentUser] objectForKey:@"name"];
NSString *thankYouString = [[NSString stringWithFormat:@"Lorem Ipsum....., %@, Lorem.......", userName] uppercaseString];
NSRange nameRange = [thankYouString rangeOfString: [userName uppercaseString]];
NSDictionary *thankYouAttributes = @{
NSFontAttributeName: ostritchSansFont,
NSParagraphStyleAttributeName: paragraphStyle,
NSForegroundColorAttributeName: [UIColor colorWithWhite:0 alpha:0.7]
};
NSMutableAttributedString *thankYouAttrString = [[NSMutableAttributedString alloc]
initWithString:thankYouString
attributes:thankYouAttributes];
// Colocando o verde no nome
[thankYouAttrString addAttribute:NSForegroundColorAttributeName
value:[UIColor colorWithRed:(76/255.0)
green:(175/255.0)
blue:(80/255.0)
alpha:1]
range:nameRange];
_thankYoutTextView.attributedText = thankYouAttrString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment