Created
December 23, 2011 00:54
-
-
Save jaminguy/1512577 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
- (void)configureScoreDescriptionText { | |
if(kloutUser.kscoreDescription) { | |
CTTextAlignment kAlignment = kCTLeftTextAlignment; | |
CGFloat lineSpacing = 1.0; | |
CTParagraphStyleSetting paragraphSettings[] = { | |
{ kCTParagraphStyleSpecifierAlignment, sizeof(kAlignment), &kAlignment}, | |
{ kCTParagraphStyleSpecifierLineSpacing, sizeof(lineSpacing), &lineSpacing} | |
}; | |
NSMutableDictionary *stringAttributes = [NSMutableDictionary dictionary]; | |
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(paragraphSettings, sizeof(paragraphSettings)); | |
[stringAttributes setObject:(__bridge_transfer id)paragraphStyle forKey:(NSString *)kCTParagraphStyleAttributeName]; | |
CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontSystemFontType, kScoreDescriptionFontPointSize, NULL); | |
[stringAttributes setObject:(__bridge_transfer id)font forKey:(id)kCTFontAttributeName]; | |
CGColorRef textColor = CGColorCreateCopy([[UIColor kloutDarkGray] CGColor]); | |
[stringAttributes setObject:(__bridge_transfer id)textColor forKey:(id)kCTForegroundColorAttributeName]; | |
self.kscoreScoreView.attributedString = [[NSAttributedString alloc] initWithString:kloutUser.kscoreDescription attributes:stringAttributes]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment