采用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 is available through CocoaPods. To install it, simply add the following line to your Podfile:
在Podfile中添加: source 'https://cdn.cocoapods.org/'
pod 'YWTableExcel'
flyOfYW, [email protected]
YWTableExcel is available under the MIT license. See the LICENSE file for more info.