(2) 修改临时变量的属性
(3)将临时变量重新设置给对象的结构体属性
3. 在程序开发中需要避免出现魔法数字(Magic Number)
使用枚举类型,可以避免在程序中出现魔法数字
(1)枚举类型实质上就是一个整数,其作用就是用来替代魔法数字
(2)枚举类型中,指定了第一个整数之后,后面的数字会递增
4. frame & bounds & center
1> frame可以修改对象的位置和尺寸
2> bounds可以修改对象的尺寸
3> center可以修改对象的位置
5. 首尾式动画
复制代码
// beginAnimations表示此后的代码要“参与到”动画中
[UIView beginAnimations:nil context:nil];
// setAnimationDuration用来指定动画持续时间
[UIView setAnimationDuration:2.0];
self.headImageView.bounds = rect;
......
// commitAnimations,将beginAnimation之后的所有动画提交并生成动画
[UIView commitAnimations];
下面来罗列一下UIButton的基本属性罗列
第一、UIButton的定义
复制代码
UIButton *button=[[UIButton buttonWithType:(UIButtonType);
能够定义的button类型有以下6种,
复制代码
typedef enum {
UIButtonTypeCustom = 0, 自定义风格










