Skip to content

Instantly share code, notes, and snippets.

@jaminguy
Created December 23, 2011 00:54
Show Gist options
  • Save jaminguy/1512577 to your computer and use it in GitHub Desktop.
Save jaminguy/1512577 to your computer and use it in GitHub Desktop.
- (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