一 IOS 系统控件
UILabel 文本标签
初始化::UILabel * label = [[UILabel alloc] init];
1.设置文本信息:label.text = @"文本";
或:NSString * text = @"name"; label.text = text;
2. 设置文本颜色:label.textColor = [UIColor blackColor];
3. 设置文本位置:lavbel.frame = CGRectMake(100,100,100,30);(x,y,width,hight)
4. 设置背景颜色:label.backgroundColor = [UIColor clearColor]; 透明
5. 设置文本字体大小:label.font = [UIFont systemFontOfSize: 20];
6. 设置文本字体大小自适应控件宽度:label.adjustsFontSizeToFitWidth = YES;
7. 设置文本居中显示:label.textAlignment = NSTextAlignmentCenter;
8. 将文本加入主页面显示:[self.view addSubview: label];
UIButton 按钮
初始化:UIButton * button = [UIButton buttonWithType: UIButtonTypeCustom]; 系统风格按钮
1. 设置按钮位置:button.frame = CGRectMake(100, 100, 100, 30);
2. 设置按钮常规状态:[button setTitle: @"" forState: UIControlStateNormal];
3. 设置按钮常规颜色:[button setTitleColor: [UIColor blackColor] forState: UIControlStateNormal];
4. 设置按钮文本字体大小:button.titleLabel.font = [UIFont systemFontOfSize: 20];
5. 设置按钮背景颜色:button.backgroundColor = [UIColor clearColor];
6. 设置按钮图片:[button setImage: [UIImage imageNamed: @"wifi_button.png"] forState: UIControlStateNormal];
7. 设置当按钮不可用时变灰:button.adjustsImageWhenDisabled = YES;
8. 设置点击按钮时高亮:button.showsTouchWhenHighlighted = YES;
9. 设置按钮边框宽度:button.layer.borderWidth = 2;
10. button.layer.cornerRadius = 5;
11. button.clipsToBounds = YES;
12. button.layer.borderColor = [UIColor clearColor].CGColor;
13. 添加按钮点击事件响应:[button addTarget:self action:@selector(btnLoginDown) forControlEvents: UIControlEventTouchUpInside];
14. [self.view addSubview: button];