The following are some of your friendly support:
Made a product, need popularity support a bit, Android and iPhone 91 market search # super junior mission #, or directly to the page to download the http://m.ixingji.com/m.html? P = x16. You can join us.
The same line of text can display different fonts, bold, italic, and color texts, and feedback click events.
Inherited from uilabel
1. From open-source tttattributedlabel
Https://github.com/mattt/TTTAttributedLabel
2. This involves a concept nsmutableattributedstring. It seems to be mainly used for conversion in HTML and text. For specific usage, see the following code.
3. How to use:
#import "TTTAttributedLabel.h"#import <UIKit/UIKit.h>#import <CoreText/CoreText.h>self.summaryLabel = [[[TTTAttributedLabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)] autorelease];self.summaryLabel.font = [UIFont systemFontOfSize:kSummaryTextFontSize];self.summaryLabel.textColor = [UIColor blackColor];self.summaryLabel.lineBreakMode = UILineBreakModeWordWrap;self.summaryLabel.numberOfLines = 0;self.summaryLabel.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCTUnderlineStyleAttributeName];self.summaryLabel.highlightedTextColor = [UIColor redColor];self.summaryLabel.shadowColor = [UIColor colorWithWhite:0.87 alpha:1.0];self.summaryLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);self.summaryLabel.verticalAlignment = TTTAttributedLabelVerticalAlignmentTop;NSMutableAttributedString * tttstring = [[NSMutableAttributedString alloc] initWithString:@"firstsecondthird"];UIFont *italicSystemFont = [UIFont italicSystemFontOfSize:kSummaryTextFontSize];CTFontRef italicFont = CTFontCreateWithName((CFStringRef)italicSystemFont.fontName, italicSystemFont.pointSize, NULL);if(italicFont){ [tttstring addAttribute:(NSString *)kCTFontAttributeName value:(id)italicFont range:NSMakeRange(5,6)];}CFRelease(italicFont);[tttstring addAttribute:(NSString*)kCTForegroundColorAttributeName value:(id)[[UIColor redColor] CGColor] range:NSMakeRange(0,5)];[self.summaryLabel setText:tttstring];
See
4. Recommended articles
How to make IOS and Android support custom Fonts
Http://icyleaf.com/2011/07/06/custom-fonts-both-in-ios-and-android/
Uilabel of the Custom font
Http://pimacun.72pines.com/2011/05/09/%E8%87%AA%E5% AE %9A%E4%B9%89%E5%AD%97%E4%BD%93%E7%9A%84uilabel/
Http://blog.csdn.net/microchenhong/article/details/6542994