1] iOS开发的学习方法:多敲代码,坚持。
2]UI阶段的学习重点:
2.1]学习UIKit框架中的每一个类
2.2]熟悉常用的控件用法,能够使用代码方式创建,并且添加
3]ViewController跟里面属性View 的关系: VIewController负责管理里面View包含的事件
4] UIView的属性及使用
4.1]创建一个view,同时要设定view的background、position、size
UIView *v = [[UIView alloc]init]
v.backgroundColor= [UIColor redColor]
v.frame = CGRectMark(100,100,100,100)
4.2]另一种创建View并且直接定义size的方式
UIView *v = [[UIView alloc] initWithFrame:CGRectMark(100,100,100,100)];

5] 创建动画
5.1]视图动画创建注意点,不能直接通过修改控件的Frame属性 但是可以通过把Frame值保存在一个临时变量中
CGRect oldFrame = v.frame;
oldFrame.origin.x = 200;
5.2] 创建动画方式一:首尾动画
[UIView beginAnimations:nil context:nil];
设置动画持续时间:
[UIView setAnimationDuriation:3]
[UIView setAnimationDelay :1]
结束动画标志
v.frame = oldFrame;
[UIView commitAnimations];
5.3]block实现动画
[UIView animateWithDuration:3 animations:^{
v.frame = oldFrame;
}

6] UITextField、UILabel类的取值赋值
[self.field.text intValue]
self.label.text = [NSString stringwithFormat:@"%d",f];
6.1]keyboard的隐藏
方法一:根据filed隐藏 resignFirstResponder
[self.field resignFirstResponder]
方法二:根据view endEditting
[self.viewendEditting:true];

7]UIButton 的注意事项
1、image和background的区别
image与文字并列
background隐藏在文字后方
2、点击时按钮的变化状态 static config - highlighted
代码设置:
1、创建按钮
UIButton *btn = [[UIButton alloc]init]
2、创建按钮大小
btn.frame = CGRectMark(100,100,100,199);
3、设置图片
UIImage *img = [UIImage imageNamed:@“xx”]
[btn setBackgroundImage:image forState:UIControlStateNormal/UIControlStateHighLighted(选择时的状态)]
4、设置按钮标题
[btn setTitle:@“helloworld” forState :UIControlStateNormal/UIControlStateHighLighted]
5、设置标题颜色
[btn setTitleColor: [UIColor:redColor]forState: UIControlStateNormal];
6、加载按钮
[self.view.addSubview:btn]
7、设置目标方法
[btn addTarget:self action:@selected(methodName) forControlEvents: UIcontrolEventsTouchUpInside];

浙公网安备 33010602011771号