CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | May 2016 |
Maintained by Julian Krumow, Julian Krumow.
A UITableView with cells shaped like facets.
To run the example project; clone the repo, and run pod install
from the TBFacetTableViewDemo
directory first.
This pod consists of three classes:
TBFacetTableViewCell
- UITableViewCell shaped like a facet or shardTBFacetTableViewCellConfigurator
- configures the cellsTBFacetTableViewCellObserver
- handles the highlight state of the cellsTo use the classes in your code just import TBFacetTableViewCellConfigurator.h
.
Implement the TBFacetTableViewCellConfiguratorDataSource
protocol. The best place is your UIViewController
subclass or UITableViewDatasource
implementation:
- (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
}
Create an instance of TBFacetTableViewCellConfigurator
passing a regular UITableView
instance or subtype:
_facetCellConfigurator = [[TBFacetTableViewCellConfigurator alloc] initWithTableView:_facetTableView
dataSource:self];
Configure your TBFacetTableViewCell
by passing it and its index path:
- (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 is available under the MIT license. See the LICENSE file for more info.