//程序員
// ViewController.mide
// 手寫控件字體
//ui
// Created by 非凡程序員 on 15/11/11.spa
// Copyright (c) 2015年 Querida. All rights reserved..net
//3d
#import "ViewController.h"orm
@interface ViewController ()get
@end it
@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