1.昨天碰到的一个问题,列表分组拉不上去的原因:
TableView没有放好,放在了view视图偏下,导致运行时列表始终拉不上去,在使用列表的时候注意摆好位置。
2.tableview 加载更多的实现
很简单,自定义一个cell用来显示加载更多字样,然后通过
UINib *nib = [UINib nibWithNibName:@"NextPageCell" bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:identifier];
注册自定义的cell
NextPageCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 获得自定义cell的实例
numberOfRowsInSection这个方法中返回,data.count +1
然后在点击的时候判断是否点击的是最后一个,即判断indexPath.row+1 == data.count+1 如果是则是点击加载更多,加载数据,
用[tableView reloadData]方法重新装载新添加的数据
UITableView
didSelectRowAtIndexPath
didDeselectRowAtIndexPath 这两个方法一旦粗心就很容易搞混,多注意点
//用来实现根据字母查询分组
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return keys;
}
在显示不同的UITableViewCell的时候 static NSString *cellIdentifier = @"CellIndentifier_";//这个标识会影响cell