要运行示例项目,首先克隆仓库,然后从 Example 目录中运行 pod install
。
UIFastTableView 通过 CocoaPods 提供可用。要安装它
,只需将以下行添加到您的 Podfile 中
pod "UIFastTableView"
NSMutableArray *arrays = [[NSMutableArray alloc]init];
for (int i = 0; i<6; i++) {
[arrays insertObject:MJRandomData atIndex:0];
}
CGRect tbvFrame = CGRectMake(0, 60, self.view.frame.size.width, self.view.frame.size.height);
//初始化
_tbv = [[EZJFastTableView alloc]initWithFrame:tbvFrame];
//给 tableview 赋值
// [_tbv setDataArray:arrays];
[_tbv onBuildCell:^(id cellData,NSString *cellIdentifier,NSIndexPath *index) {
UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.userInteractionEnabled = true;
cell.textLabel.text = cellData;
return cell;
}];
//动态改变
[_tbv onChangeCellHeight:^CGFloat(NSIndexPath *indexPath) {
if (indexPath.row==1) {
return 100.0;
}
if (indexPath.row==4) {
return 80.0;
}
return _tbv.rowHeight;
}];
//允许上行滑动
[_tbv onDragUp:^NSArray * (int page) {
return [self loadNewData:page];
}];
//允许下行滑动刷新
[_tbv onDragDown:^{
}];
//设置选中事件 block 设置方式
//indexPath 是当前行对象 indexPath.row(获取行数)
//cellData 是当前行的数据
[_tbv onCellSelected:^(NSIndexPath *indexPath, id cellData) {
NSLog(@"click");
}];
wallen, [email protected]
UIFastTableView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。