Skip to content

Instantly share code, notes, and snippets.

@sgoodwin
Created November 19, 2012 19:22
Show Gist options
  • Save sgoodwin/4113057 to your computer and use it in GitHub Desktop.
Save sgoodwin/4113057 to your computer and use it in GitHub Desktop.
UITableViewDataSource method with switches, but with symbols.
typedef enum {
RWSSectionInfo,
RWSSectionDynamic,
RWSSectionCount
}RWSSection;
const NSInteger kNumberOfInfoRows = 2;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
RWSSection sectionIndex = section;
switch(sectionIndex){
case RWSSectionInfo:
return kNumberOfInfoRows;
break;
case RWSSectionDynamic:
return [self.items count];
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment