Skip to content

Instantly share code, notes, and snippets.

@mako34
Created November 5, 2013 23:16
Show Gist options
  • Save mako34/7328099 to your computer and use it in GitHub Desktop.
Save mako34/7328099 to your computer and use it in GitHub Desktop.
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return objectArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
UILabel *titleLabel = (UILabel *)[loadedCell viewWithTag:1];
titleLabel.text = [current objectForKey:@"name"];
UILabel *captionLabel = (UILabel *)[loadedCell viewWithTag:builder.captionTag];
captionLabel.text = [current objectForKey:@"caption"];
UIImageView *imageView = (UIImageView *)[loadedCell viewWithTag:builder.iconTag];
imageView.image = [UIImage imageNamed:builder.selected ? @"comment_plus_48.png" : @"comment_minus_48.png"];
return cell;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
MyDetailViewController *controller = [[MyDetailViewController alloc] init];
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment