CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by Parker Wightman.
Accordion-style table view, with block-based delegation.
CocoaPods soon, but you can drop PDTiledView.h/.m into your project for now.
Very similar to UITableView, but uses sections and tiles instead of sections and rows. It also uses blocks instead of protocols for delegation.
PDTiledView *tiledView = ...;
tiledView.numberOfSectionsBlock = ^NSInteger { return 4; };
tiledViewdView.numberOfTilesInSectionBlock = ^NSInteger (NSInteger section) { return 20; };All sections and tiles are just UIControl subclasses, such as UIButton or a custom control of your making. (This may switch to UIView later, not sold on it yet).
tiledView.controlForSectionBlock = ^UIControl *(NSInteger section) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = [UIColor whiteColor];
return button;
};
tiledView.controlForTileAtIndexPathBlock = ^UIControl *(PDIndexPath indexPath) {
UIButton *button = [UIButton buttonWithType:UIControlIButtonTypeCustom];
return button;
};As a result of block-based delegation, you should explicitly call reloadData the first time the view will be displayed.
[tiledView reloadData];You can also programmatically select a section by calling selectSection:animated:.
[tiledView selectSection:0 animated:NO];There are also optional blocks to further customize how you like. They match up with their UITableViewDelegate/DataSource counterparts:
heightForSectionControlBlockheightForTilesInSectionBlockdidSelectSectionBlockdidSelectTileAtIndexPathBlockwillDisplaySectionBlock willDisplayTileAtIndexPathBlock (This is where you should apply styling that is frame-dependent, as its final dimensions will be set. Same with willDisplaySectionBlock)The internal implementation does not use UITableViews, so while some things are cached, tiles are not loaded on-the-fly and cached as rows are in UITableView. This shouldn't be a big deal unless you are displaying 1,000s of tiles or tiles are extremely rendering intensive. Pull requests are more than welcome to help implement caching, or perhaps to use UITableViews internally.
This also means that controlForSectionBlock and controlForTileAtIndexPathBlock are not called multiple times, usually just once.
git checkout -b my-new-feature)git commit -am 'Added some feature')git push origin my-new-feature)