Created
November 5, 2013 23:16
-
-
Save mako34/7328099 to your computer and use it in GitHub Desktop.
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
#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