Skip to content

Instantly share code, notes, and snippets.

@jkhowland
Created January 30, 2015 07:17
Show Gist options
  • Save jkhowland/2b427e074a776f21f125 to your computer and use it in GitHub Desktop.
Save jkhowland/2b427e074a776f21f125 to your computer and use it in GitHub Desktop.
OnTheLine-TableViewDataSource
- (IBAction)takePhoto:(id)sender {
self.photoCount++;
[self.tableView reloadData];
}
#pragma mark - Table view data source
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PhotoCell"];
cell.textLabel.text = [NSString stringWithFormat:@"Photo %ld", (long)indexPath.row];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
switch (section) {
default:
return self.photoCount;
break;
}
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment