#import"ViewController.h"
@interfaceViewController()
@property(weak,nonatomic)IBOutletUIButton*loginbutton;
@property(weak,nonatomic)IBOutletUILabel*lable;
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
//**用富文本快速設(shè)置Label的文字:字體,大小,顏色
NSMutableParagraphStyle*ps = [[NSMutableParagraphStylealloc]init];
//可以通過ps設(shè)置行距,間距,對(duì)齊方式,拆行方式
[pssetAlignment:NSTextAlignmentCenter];// 居中對(duì)齊
NSDictionary*attribs=@{
NSFontAttributeName: [UIFontfontWithName:@"Verdana"size:50],
NSForegroundColorAttributeName:[UIColorredColor],NSParagraphStyleAttributeName:ps};
NSMutableAttributedString*attributedText =[[NSMutableAttributedStringalloc]initWithString:self.lable.textattributes:attribs];
self.lable.attributedText= attributedText;
//**用富文本快速設(shè)置UIbutton Title的文字:字體,大小,顏色
NSMutableAttributedString*attributedTextForButton =[[NSMutableAttributedStringalloc]initWithString:self.loginbutton.titleLabel.textattributes:attribs];
[self.loginbuttonsetAttributedTitle:attributedTextForButtonforState:UIControlStateNormal];
// Do any additional setup after loading the view, typically from a nib.
}