Skip to content

Instantly share code, notes, and snippets.

@asmallteapot
Created January 23, 2012 18:07
Show Gist options
  • Save asmallteapot/1664575 to your computer and use it in GitHub Desktop.
Save asmallteapot/1664575 to your computer and use it in GitHub Desktop.
Using C99 for clever and non-fragile UITableView configuration. Allows implicit defaults. Copypasta’d from a screencap tweeted by @jonsterling: http://twitpic.com/80uyfp
typedef enum {
kAccomplishmentTitleSection = 0,
kAccomplishmentCategorySection,
kNumberOfSections
} NESTemplateEditTableSections;
static NSString * const kCellIdentifiers[] = {
[kAccomplishmentTitleSection] = @"AccomplishmentTitleCell",
[kAccomplishmentCategorySection] = @"AccomplishmentCategoryCell"
};
static UITableViewCellSelectionStyle const kCellSelectionStyles[] = {
[kAccomplishmentTitleSection] = UITableViewCellSelectionStyleBlue,
[kAccomplishmentCategorySection] = UITableViewCellSelectionStyleNone
};
static UITableViewCellAccesoryType const kCellAccesoryTypes[] = {
[kAccomplishmentCategorySection] = UITableViewCellAccessoryDisclosureIndicator
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment