ios UI day01

1.NSObject 是所有类的父类


2.UIViewController 继承自UIResponder ,UIResponder继承自NSObject;

UIViewController是所有控制器的父类;


3.UIViewController是mvc中的Controller的作用,是沟通dataSource和view之间的桥梁


4.ViewController的声明周期

loadView:创建视图控制器

viewDidLoad:加载视图

viewWillAppear:视图加载前运行

viewWillDisAppear:视图消失前(被关闭或者覆盖的时候)运行

willRotateToInterfaceOrientation:duration: 开始旋转时运行

didRotateToInterfaceOrientation:旋转结束时运行


5.关于loadView和viewDidLoad 的区别:

loadView 在视图初始化的时候调用,应用开启后只能调用一次

viewDidLoad: 在每次进入一个视图的时候,都会调用.


6.strong 和weak关键字

strong 用来修饰强引用的属性

weak 用来修饰弱引用的属性


7.UITableViewController

1).返回table中的行数

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSINteger)section:{

return [self.array count];

}


2).分组的形式,一共返回多少组数据

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{


return 4;

}


//设置行高

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSINdexPath *)indexPath{

return 60;

}


3).UITableView的点击事件

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

UIAlertView *alert = [[UIALertView alloc] initWithTitle:@"提示" message:@"this is a alertView" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil,nil];

[alert show];


}









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值