//
// ViewController.m
// 手写控件
//
// Created by 非凡程序员 on 15/11/11.
// Copyright (c) 2015年 Querida. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(20, 20, 300, 200)];
//标签文字内容
lable.text=@"CuiXiaoYu";
//标签文字字体格式和字体大小
lable.font=[UIFont fontWithName:@"Zapfino" size:30];
//设置标签字体颜色
lable.textColor=[UIColor yellowColor];
//设置圆角边框的角度
lable.layer.cornerRadius=20;
//设置背景颜色
lable.backgroundColor=[UIColor redColor];
//设置标签边框的颜色
lable.layer.borderColor=[UIColor blackColor].CGColor;
//设置标签边框的宽度
lable.layer.borderWidth=20;
//标签文字居中
lable.textAlignment=NSTextAlignmentCenter;
//将控件添加到当前图层上
[self.view addSubview:lable];
// --------关于UITextFeild--------
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(20, 400, 100, 80)];
[button setTitle:@"按钮" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
button.backgroundColor=[UIColor orangeColor];
[button addTarget:self action:@selector(diJi:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
-(void)diJi:(UIButton *)b{
NSLog(@"点了~");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end