iOS7 UILabel

####iOS7 Programming Cookbook 第一章学习笔记 UILabel

#####Customizing the UILabel

#####ViewController.m

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@interface ViewController ()
@property (nonatomic, strong) UILabel *label;
@end

@implementation ViewController

- (void)viewDidLoad{
[super viewDidLoad];

//创建label
self.label = [[UILabel alloc] init];
//清除uilabel背景颜色
self.label.backgroundColor = [UIColor clearColor];
//
self.label.text = @"iOS SDK";
//字体大小
self.label.font = [UIFont boldSystemFontOfSize:70.0f];
//字体颜色
self.label.textColor = [UIColor blackColor];
//阴影颜色
self.label.shadowColor = [UIColor lightGrayColor];
//影子抵消(以点)的文本
self.label.shadowOffset = CGSizeMake(2.0f, 2.0f);
// self.label.frame = CGRectMake(30, 30, 320, 100);
//调整大小
[self.label sizeToFit];
//view中心
self.label.center = self.view.center;
//添加到view
[self.view addSubview:self.label];

}

@end

Reference

坚持原创技术分享,您的支持将鼓励我继续创作!
0%