您的位置:首页 > 移动开发 > IOS开发

iOS tableview的delegate和datasource执行顺序

2017-08-30 19:11 393 查看
前段时间去面试的时候遇到这道题,结果只知道一个大概调用顺序,于是写了一个demo测试了一下,执行这些方法的顺序如下:

1.//有多少列

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

2.//cell 页眉高度

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

3.//cell页脚高度

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

4.//每组有多少行

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

5.//cell高度

-(CGFloat)tableView:(UITableView )tableView heightForRowAtIndexPath:(NSIndexPath )indexPath

6.//布局UItableviewcell

-(UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  uitableview delegate ios
相关文章推荐