【iOS系列】-UITableView的使用

UITableView的使用:


第一:数据展示条件
1,UITableView的所有数据都是由数据源(dataSource)提供,所以想在UITableView展示数据,必须设置UITableview的dataSource数据源对象
2,想要当UITableView的dataSource对象,必须遵守UITableDataSource协议,实现相应的数据源方法
3,当UITableView想要展示数据的时候,会给数据源发送消息(调用数据源方法),UITableView会根据方法返回值决定展示的数据

第二:数据展示的过程
1,先调用数据源的
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
得知一共有多少组
2,调用数据源的
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
得知section组有所少行
3,调用数据源的
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
得知第indexPath.section组,第indexPath.row行,展示怎样的cell

作者:Darren

微博:@IT_攻城师

github:@Darren90

出处:http://www.cnblogs.com/fengtengfei/

原文地址:https://www.cnblogs.com/fengtengfei/p/4263623.html