-
NSMutableParagraphStyle *ps = [[NSMutableParagraphStyle alloc] init];
-
[ps setAlignment:NSTextAlignmentCenter];
-
NSDictionary *attribs = @{NSFontAttributeName: [UIFont fontWithName:@"Microsoft Yahei" size:45],NSParagraphStyleAttributeName:ps};
-
NSMutableAttributedString *attributedText =[[NSMutableAttributedString alloc] initWithString:super.text
-
attributes:attribs];
-
super.attributedText = attributedText;
NSString *testString = @"NSMutableAttributed---0";
UILabel *testLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 100, 200, 40)];
NSMutableAttributedString * testAttriString = [[NSMutableAttributedString alloc] initWithString:testString];
[testAttriString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica-Bold" size:15] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleDouble] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSVerticalGlyphFormAttributeName value:[NSNumber numberWithInt:1] range:NSMakeRange(0, testAttriString.length)];
[testAttriString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, testAttriString.length)];
testLabel.attributedText = testAttriString;