TBFacetTableView 1.0.1

TBFacetTableView 1.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年5月

Julian KrumowJulian Krumow 维护。




  • Julian Krumow

具有类似棱面单元格的 UITableViewCell。

Screenshot facets

Screenshot facets highlihgted

示例项目

要运行示例项目;克隆仓库,并首先从 TBFacetTableViewDemo 目录运行 pod install

需求

  • Xcode 5
  • iOS 5.0

安装

使用

该 pod 包含三个类

  • TBFacetTableViewCell - 棱形或碎片形状的 UITableViewCell
  • TBFacetTableViewCellConfigurator - 配置单元格
  • 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 文件。