Skip to content

twobitlabs/TBGenericTableViewController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

GenericTableViewController is a UITableViewController subclass for declaratively defining table views. To use it, simply subclass GenericTableViewController and add table sections using:

[self addSectionWithKey:@"settings" header:settingHeaderView footer:settingsFooterView];

...and add rows using:

NSDictionary *versionCell = [NSDictionary dictionaryWithObjectsAndKeys:
                             @"Select version", kLabelKey,
                             [NSNumber numberWithInt:GenericTableCellStyleButton], kRowTypeKey,
                             NSStringFromSelector(@selector(selectVersion:)), kSelectorKey,
                             nil];
[self addRowToSection:@"settings" row:versionCell];

It's fairly flexible as is, and easy to extend with additional configuration and behavior. More documentation on available cell types and options to come.

This idea was originated by Matt Gallagher and improved by Craig Hockenberry. The original approach defined different row types, each with a class that defined its API. Matt later later came up with a more generic approach with a more flexible API. I liked Matt's latter approach, but I find his API a bit confusing, so I took my own whack at it. I welcome your forks and feedback, and I'd love to know if you're using it in your project.

About

UITableViewController subclass for declaratively defining table views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published