测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2016年5月 |
由 Julian Krumow,Julian Krumow 维护。
具有类似棱面单元格的 UITableViewCell。
要运行示例项目;克隆仓库,并首先从 TBFacetTableViewDemo
目录运行 pod install
。
该 pod 包含三个类
TBFacetTableViewCell
- 棱形或碎片形状的 UITableViewCellTBFacetTableViewCellConfigurator
- 配置单元格TBFacetTableViewCellObserver
- 处理单元格的突出显示状态要在您的代码中使用这些类,请仅导入 TBFacetTableViewCellConfigurator.h
。
实现 TBFacetTableViewCellConfiguratorDataSource
协议。最佳位置是您的 UIViewController
子类或 UITableViewDatasource
实现
- (UIColor *)facetTableViewCellConfigurator:(TBFacetTableViewCellConfigurator *)facetTableViewCellConfigurator facetColorForCellAtIndexPath:(NSIndexPath *)indexPath
{
return // whatever color you like
}
- (UIColor *)facetTableViewCellConfigurator:(TBFacetTableViewCellConfigurator *)facetTableViewCellConfigurator highlightColorForCellAtIndexPath:(NSIndexPath *)indexPath;
{
return // whatever color you like
}
- (CGPathRef)facetTableViewCellConfigurator:(TBFacetTableViewCellConfigurator *)facetTableViewCellConfigurator topPathForCellAtIndexPath:(NSIndexPath *)indexPath
{
return // whatever CGPathRef you like - should match bottom path of cell above
}
- (CGPathRef)facetTableViewCellConfigurator:(TBFacetTableViewCellConfigurator *)facetTableViewCellConfigurator bottomPathForCellAtIndexPath:(NSIndexPath *)indexPath
{
return // whatever CGPathRef you like - should match top path of cell below
}
创建一个 TBFacetTableViewCellConfigurator
实例,并将其传递给常规的 UITableView
实例或子类型
_facetCellConfigurator = [[TBFacetTableViewCellConfigurator alloc] initWithTableView:_facetTableView
dataSource:self];
通过传递单元格及其索引路径来配置您的 TBFacetTableViewCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TBFacetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[TBFacetTableViewCell reuseIdentifier]
forIndexPath:indexPath];
[_facetCellConfigurator configureCell:cell atIndexpath:indexPath];
return cell;
}
Julian Krumow,[email protected]
TBFacetTableView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。