Created
January 30, 2015 07:17
-
-
Save jkhowland/2b427e074a776f21f125 to your computer and use it in GitHub Desktop.
OnTheLine-TableViewDataSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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