YWTableExcel
采用UITableView和UICollectionView嵌套使用来实现Excel、课程表、上下左右联动效果;基于YWExcel的痛点作出的修改版本,左右滑动使用UICollectionView达到复用,且支持点击事件,更多自定义功能
简介
- 文本显示
- 每行支持选择
- 每个单元格支持选择
- 支持分组
- 支持自定义表头和表尾
- 支持自定义组头
- 支持刷新
效果图
示例
- (void)viewDidLoad{
YWTableExcelViewMode *mode = [YWTableExcelViewMode new];
mode.columnStyle = YWTableExcelViewColumnStyleText;//不需要点击模式
YWTableExcelView *excelView = [[YWTableExcelView alloc] initWithFrame:CGRectZero withMode:mode];
excelView.delegate = self;
excelView.dataSource = self;
[self.view addSubview:_excelView];
}
///返回固定列表头的数据
- (NSArray<YWColumnMode *> *)tableExcelView:(YWTableExcelView *)excelView titleForFixedHeaderInSection:(NSInteger)section{
return _fixedColumnList;
}
///返回可滑动列表头的数据
-(NSArray<YWColumnMode *> *)tableExcelView:(YWTableExcelView *)excelView titleForSlideHeaderInSection:(NSInteger)section{
return _slideColumnList;
}
///行数
- (NSInteger)tableExcelView:(YWTableExcelView *)excelView numberOfRowsInSection:(NSInteger)section{
return 20;
}
///给每个单元格返回相应的数据model(固定列)
- (NSArray<YWColumnMode *> *)tableExcelView:(YWTableExcelView *)excelView fixedCellForRowAtIndexPath:(NSIndexPath *)indexPath{
return _fixedList[indexPath.row];
}
///给每个单元格返回相应的数据model(可滑动列)
- (NSArray<YWColumnMode *> *)tableExcelView:(YWTableExcelView *)excelView slideCellForRowAtIndexPath:(NSIndexPath *)indexPath{
return _slideList[indexPath.row];
}
需求
安装
YWTableExcel可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
在Podfile中添加: source 'https://cdn.cocoapods.org/'
pod 'YWTableExcel'
作者
flyOfYW, [email protected]
许可证
YWTableExcel在MIT许可证下提供。有关更多信息,请参阅LICENSE文件。