Skip to content

Instantly share code, notes, and snippets.

@cliftonlabrum
Created March 12, 2013 15:05
Show Gist options
  • Save cliftonlabrum/5143657 to your computer and use it in GitHub Desktop.
Save cliftonlabrum/5143657 to your computer and use it in GitHub Desktop.
Grouped UITableView in Objective-C
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryType = UITableViewCellAccessoryNone;
cell.accessoryView = nil;
cell.detailTextLabel.text = nil;
cell.imageView.image = nil;
// Configure the cell...
if (indexPath.section == kSyncingSection)
{
cell.textLabel.text = @"Sync";
cell.detailTextLabel.text = self.syncType;
cell.imageView.image = self.syncImage;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment