mylabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 50, 1000, 50)];
mylabel.backgroundColor=[UIColor brownColor];
[self.view addSubview:mylabel];
NSString *string=@"welcome to china";
NSMutableAttributedString *attrstring=[[NSMutableAttributedString alloc]initWithString:string];
//字体大小
[attrstring addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"DIN Condensed" size:26] range:NSMakeRange(0, 4)];
//字体颜色
[attrstring addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 2)];
// //背景色
// [attrstring addAttribute:NSBackgroundColorAttributeName value:[UIColor purpleColor] range:NSMakeRange(0, 4)];
// //间距
// [attrstring addAttribute:NSKernAttributeName value:[NSNumber numberWithFloat:12.0] range:NSMakeRange(0, string.length)];
// //删除线
// [attrstring addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:1] range:NSMakeRange(0,string.length)];
// [attrstring addAttribute:NSStrikethroughColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, string.length)];
// //倾斜度
// [attrstring addAttribute:NSObliquenessAttributeName value:[NSNumber numberWithFloat:1.3] range:NSMakeRange(0, string.length-3)];
// //拉伸
// [attrstring addAttribute:NSExpansionAttributeName value:[NSNumber numberWithFloat:1.3] range:NSMakeRange(0, string.length-3)];
// //下划线
[attrstring addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:1] range:NSMakeRange(0, string.length-3)];
[attrstring addAttribute:NSUnderlineColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, string.length-3)];
// //画笔的颜色和宽度
// [attrstring addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithInteger:2] range:NSMakeRange(0, string.length)];
// [attrstring addAttribute:NSStrokeColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, string.length-3)];
// //阴影
// NSShadow *show=[[NSShadow alloc]init];
// show.shadowBlurRadius=1.0;
// show.shadowColor=[UIColor redColor];
// show.shadowOffset=CGSizeMake(10, 1);
// [attrstring addAttribute:NSShadowAttributeName value:show range:NSMakeRange(0, 1)];
//印刷体
[attrstring addAttribute:NSTextEffectAttributeName value:NSTextEffectLetterpressStyle range:NSMakeRange(4, 10)];
mylabel.attributedText=attrstring;
}