Created
July 22, 2012 08:17
-
-
Save inonb/3158884 to your computer and use it in GitHub Desktop.
[iOS] itemをDetailViewControllerに渡す
This file contains hidden or 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
| DetailViewController.h | |
| @property (strong, nonatomic) NSDictionary *item; | |
| DetailViewController.m | |
| @synthesize item; | |
| MasterViewController.m | |
| - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| if (!self.detailViewController) { | |
| self.detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; | |
| } | |
| NSDictionary *item = [items objectAtIndex:indexPath.row]; | |
| self.detailViewController.item = item; | |
| [self.navigationController pushViewController:self.detailViewController animated:YES]; | |
| } | |
| DetailViewController.m | |
| - (void)viewDidAppear:(BOOL)animated | |
| { | |
| self.title = [[item objectForKey:@"im:name"] objectForKey:@"label"]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment