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
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
相关文章推荐
- 【iOS】UITableView delegate/dataSource方法执行顺序
- 在UITableView中iOS UITableViewDelegate UITableViewDataSource执行顺序
- iOS UITableViewDelegate UITableViewDataSource的含义 和执行顺序
- iOS UITableViewDelegate UITableViewDataSource 执行顺序
- iOS UITableViewDelegate UITableViewDataSource 执行顺序
- ios中tableview中的方法的执行顺序
- IOS给tableview的cell添加长按手势执行两次(UILongPressGestureRecognizer)
- iOS Controller 瘦身运动之 UItableView datasource 与 delegate的分离
- IOS中 ViewController中默认方法的执行顺序
- iOS属性传值(视图控制器viewController的执行顺序的理解和懒人加载的理解)
- 关于UIScrollViewDelegate协议中每个回调函数的意义及执行顺序的理解
- iOS 在tableview的侧滑事件里执行tableView.selectRow无效的解决办法
- iOS开发UITableView篇:[self.tableView reloadData]执行时间过长问题解决历程
- IOS 11 tableView 分页 执行reload() 时出现闪动
- tableView代理方法执行顺序
- Ios 自定义表示图出现的相关问题UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- Ios 该图显示其出现的相关问题定义UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- iOS工作记录五:View,UIViewController的执行顺序,生命周期
- iOS程序的启动执行顺序 AppDelegate 及 UIViewController 的生命周期
- viewController 和 tableView 相关方法执行顺序及作用