Last active
August 29, 2015 13:56
-
-
Save ritesh-fueled/9107730 to your computer and use it in GitHub Desktop.
Attributed String
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
NSMutableAttributedString *attributedString = | |
[[NSMutableAttributedString alloc]initWithString:@"someText"]; | |
NSDictionary *defaultProperties = @{ NSFontAttributeName : [UIFont defaultFont], | |
NSForegroundColorAttributeName : [UIColor defaultColor]}; | |
NSDictionary *uniqueProperty = @{ NSFontAttributeName : [UIFont uniqueFont], | |
NSForegroundColorAttributeName : [UIColor uniqueColor]}; | |
[attributedString addAttributes:defaultProperties | |
range:NSMakeRange(defaultStartLocationInIntegers, | |
defaultEndLocationInIntegers)]; | |
[attributedString addAttributes:uniqueProperty | |
range:NSMakeRange(uniqueStartLocationInIntegers, | |
uniqueEndLocationInIntegers]; | |
// to insert character spacing | |
/* | |
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text]; | |
[attributedString addAttribute:NSKernAttributeName | |
value:@(characterSpacing) | |
range:NSMakeRange(0, [text length])]; | |
self.attributedText = attributedString; | |
*/ | |
[self.someLabel setAttributedText:attributedString]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment