**lable标签**
UILabel
*lab = [[
UILabel
alloc
]
init];
lab.
frame
=
CGRectMake
(75, 50, 150, 50);
lab.
backgroundColor
= [
UIColor
purpleColor
]; 颜色
lab.text
=
@"
欢迎来到一品中国
"
;内容
lab.textAlignment
=
NSTextAlignmentCenter
; 文本布局
lab.font
= [
UIFont
systemFontOfSize
:18];字体
lab.textColor
= [
UIColor
orangeColor];字体颜色
lab.shadowColor
= [
UIColor
darkGrayColor
]; 阴影偏移量
lab.
shadowOffset
=
CGSizeMake
(2, 2);
lab.
numberOfLines
= 0; 行数
**button**
UIButton
*btn1 = [
UIButton
buttonWithType
:
UIButtonTypeInfoLight
];
btn1.
center
=
self
.
window
.
center
; 按钮中心
btn1.bounds
=
CGRectMake(0, 0, 50, 50);坐标
[btn1
setTitle:
@"Move"
forState:
UIControlStateNormal];显示字符和按键类型
btn1.backgroundColor
= [
UIColor
redColor]; 按钮周边颜色
[btn1 addTarget:selfaction:@selector(btnClick)forControlEvents:UIControlEventTouchUpInside];
**行动表**
UIActionSheet
*sheet = [[
UIActionSheet
alloc
]
initWithTitle
:
@"
下载
"
delegate
:
nil
cancelButtonTitle
:
@"Cancel"
destructiveButtonTitle
:
@"Save"
otherButtonTitles
:
@"Other"
,
@"Other1"
,
@"Other2"
,
nil
];
**textfield文本框**
UITextField
*textField = [[
UITextField
alloc
]
init
];
textField.
borderStyle
=
UITextBorderStyleBezel
;文本框类型!!必须设置
textField.
secureTextEntry
=
YES
;安全输入
_view4.alpha = 0.5;
透明度
0.0
(完全透明)
~1.0
(完全不透明)
_view4.hidden = YES;
设置隐藏
textField.
keyboardType
=
UIKeyboardTypeNumberPad
;键盘类型
textField.
frame
=
CGRectMake
(40, 100, 100, 40);坐标
**图片**
UIImageView
*imgView = [[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"2.jpg"
]];
imgView.
frame
= [[
self
window
]
bounds
];
[imgView
setFrame
:
CGRectMake
(50, 50, 50, 50)];
**scrollView**
//
设置
scrollView
的滑动范围
.
scroll.
contentSize
=
CGSizeMake
(220*5, 0);
//设置scrollView的分页[设置滑动一个单位的宽或者高]
scroll.pagingEnabled =YES;
//设置scrollView横向的显示条Horizontal横
scroll.showsHorizontalScrollIndicator =NO;
//Vertical 竖
scroll.showsVerticalScrollIndicator =NO;
//设置回弹
scroll.bounces =NO;
//
设置
x.y
向负方向的偏移量
scroll.contentOffset =CGPointMake(0, 0);
//设置scroll的代理方法
//开启代理之后对象就会自动执行该对象里面的代理方法
//属性赋值也是调方法
**动画使用方法**
[
UIView
beginAnimations
:
nil
context
:
nil
];//开始
[UIViewsetAnimationDuration:3]
//执行时间
[
UIView
setAnimationDelegate
:
self
];代理
[
UIView
setAnimationCurve
:
UIViewAnimationCurveLinear
];//移动方式
//
动画结束方法
[UIViewsetAnimationDidStopSelector:@selector(animaitonFinished)];
_vi.center =self.window.center;
[UIViewcommitAnimations];//结束
**警告框使用方法**
UIAlertView
*alertView = [[
UIAlertView
alloc
]
initWithTitle
:
@"
温馨提示
"
message:
@"
动画结束了
"
delegate:
nil
cancelButtonTitle
:
@"Cancel"
otherButtonTitles:
@"OK"
,
nil
];
[alertView
show
];
**选项卡**
NSArray
*itemsArr = @[
@"
联系人
"
,
@"
通话
"
,
@"
我的
”
];//数组
UISegmentedControl
*seg = [[
UISegmentedControl
alloc
]
initWithItems
:itemsArr];
seg.frame =CGRectMake(60, 50, 200, 40);//坐标
seg.
selectedSegmentIndex
= 0;
设置默认第一个选项被选中
seg.
tintColor
= [
UIColor
orangeColor
];
[seg
addTarget
:
self
action
:
@selector
(segClick:)
forControlEvents
:
UIControlEventValueChanged
];//调方法
[self.viewaddSubview:seg];//添加到View上