當前位置:
首頁 >
关于UILabel
發(fā)布時間:2023/11/29
44
豆豆
一:創(chuàng)建一個label
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 100, 345, 100)];
二:UILabel的一些屬性
(1) 設(shè)置文字:label.text = ? @"這是我的一個Label";
(2) 設(shè)置文字顏色:label.textColor = [UIColor redColor];
(3) 對齊方式:label.textAlignment = NSTextAlignmentCenter;
(4) 字體:label.font = [UIFont systemFontOfSize:30.f];
(5) 獲取字體:NSLog(@"%@",[UIFont familyNames]);
(6) 設(shè)置行數(shù):label.numberOfLines = 0;
(7) 設(shè)置字體陰影:label.shadowColor = [UIColor cyanColor];
? ? label.shadowOffset = CGSizeMake(2, 1);
(8) 設(shè)置label的顏色:label.backgroundColor = [UIColor blackColor];
效果如下:
?
轉(zhuǎn)載于:https://www.cnblogs.com/cityingma/p/4839714.html
總結(jié)
- 上一篇: 做梦梦到猫是胎梦吗
- 下一篇: java servlet+oracle