浅谈UI—视图的文本编辑方法
ViewController.h。。。。。。。。。。
@interface ViewController : UIViewController
@property(strong,nonatomic)UILabel *label;
@end
ViewController.m。。。。。。。。。。。
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UILabel *labelName=[[UILabel alloc]initWithFrame:CGRectMake(100, 100, 30, 550)];
labelName.backgroundColor=[UIColor greenColor];
//添加文本
labelName.text=@"姓名:htdhrsrhyrreywrw6twgwre524w";
//文本颜色
labelName.textColor=[UIColor redColor];
//文本对齐方式
labelName.textAlignment=NSTextAlignmentCenter;//(left、right)
//文本字号
labelName.font=[UIFont systemFontOfSize:20];
//文本行数
labelName.numberOfLines=5;
[self.view addSubview:labelName];
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UILabel *labelName=[[UILabel alloc]initWithFrame:CGRectMake(100, 100, 30, 550)];
labelName.backgroundColor=[UIColor greenColor];
//添加文本
labelName.text=@"姓名:htdhrsrhyrreywrw6twgwre524w";
//文本颜色
labelName.textColor=[UIColor redColor];
//文本对齐方式
labelName.textAlignment=NSTextAlignmentCenter;//(left、right)
//文本字号
labelName.font=[UIFont systemFontOfSize:20];
//文本行数
labelName.numberOfLines=5;
[self.view addSubview:labelName];
}