Created
January 16, 2017 16:18
-
-
Save Quaggie/aac43d8a443e87bdbfd9ace5027a828f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
@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