#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// 获取屏幕的尺寸
// UIScreen *screen = [UIScreen mainScreen];
// CGFloat width = screen.bounds.size.width;
// CGFloat heigth = screen.bounds.size.height;;
// CGFloat width = [UIScreen mainScreen].bounds.size.width;
// CGFloat heigth = [UIScreen mainScreen].bounds.size.height;
// UILable
UILabel *lable = [[UILabel alloc]initWithFrame:CGRectZero];
// UILabel *lable = [[UILabel alloc]init];
lable.frame = CGRectMake(ScreenWidth/2-150, ScreenHeigth/2-150, 300, 300);
lable.text = @"“[羞嗒嗒]再不疯狂我们就老了,没有回忆怎么祭奠呢,还有什么永垂不朽呢,错过的你都不会再有。” - 李宇春《再不疯狂我们就老了》[噢耶]→ O网页链接 [心] 新的2016,做自己想做的想做的事情吧~ [玫瑰] 很多事情错过了,就不会再有,把握每一寸宝贵的时光,给自己留下多一些美好的回忆。一件事你期望太高你就输了,一份情你付出太多你就累了,一个人你等的久了你就痛了。记住,生活中没有过不去的难关,生命中也没有离不开的人。如果你不被珍惜,不再重要,学会华丽的转身。你可以哭泣,可以心疼,但不能绝望。今天的泪水,会是你明天的成长;今天的伤痕,会是你明天的坚强。";
lable.font = [UIFont systemFontOfSize:18];
//找出所有字体样式
NSArray *fArr = [UIFont familyNames];
NSLog(@"%@",fArr);
// 字体大小
lable.font = [UIFont fontWithName:@"Bodoni 72 Smallcaps" size:20];
lable.font = [UIFont boldSystemFontOfSize:17];
lable.textColor = [UIColor blueColor];
// 在lable中是文本换行
lable.numberOfLines = 0; //0代表无限制lable的行数
// 文本对齐方式,默认是NSTextAlignmentLeft
lable.textAlignment = NSTextAlignmentCenter;
// 设置文字过长时的显示格式
lable.lineBreakMode = NSLineBreakByTruncatingMiddle;
// 背景颜色
self.view.backgroundColor = [UIColor blueColor];
// 文本框颜色
lable.backgroundColor = [UIColor yellowColor];
// [self.view addSubview:lable];
UILabel *lable1 = [[UILabel alloc]initWithFrame:CGRectZero];
NSString *str = @"让你笑到没心没肺那个人,是最爱你的人";
lable1.text = str;
// lable1.frame = CGRectMake(ScreenWidth/2-150, ScreenHeigth/2-150, 300, 300);
lable1.backgroundColor = [UIColor redColor];
lable1.font = [UIFont systemFontOfSize:18];
CGSize size = [str sizeWithAttributes:@{NSFontAttributeName:lable1.font}];
lable1.frame = CGRectMake(ScreenWidth/2-size.width/2, ScreenHeigth/2-size.height/2, size.width, size.height);
[self.view addSubview:lable1];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end