Hey guys,
I was hoping someone can chime in and give me a view tips on how to do this...
I'm working with the AdvancedTableViewCells Tutorial, and I created a New View that would show when a user touches a cell.
i.e.... if they click on "Denmark" then a new view would show saying "Cheerioz!"
Everything in the cell is from a plist.
What I would like to do is when a user clicks on the cell, the same data will be passed onto the New View.... i.e. Publisher, Name, Icon will show into the new view.
The advice that I got was to load the plist into an NSArray using -initWithContentsOfFile: and the path to the file in the bundle.
Then, in "didSelectRow..." , say the indexPath.row is 1. To access the Publisher of Item 1 (the second item), you would want the second element of the array, and of that element (which is a dictionary), you want the object whose key is "Publisher" .
I would write this... myLabel.text = [[array objectAtIndex: indexPath.row] objectForKey
"Publisher"];
_______________________________________________________________
The coding that I have right now in the "didSelectRow...." (this is in the RootViewController.m)
Question... will I be loading the plist using "initWithContentsOfFile" in the "didSelectRow..."?
And can anyone give me a tip on how I would write the "myLabel.text...." in the "didSelectRow"???
Thanks!
I would greatly appreciate any advice!!!
I was hoping someone can chime in and give me a view tips on how to do this...
I'm working with the AdvancedTableViewCells Tutorial, and I created a New View that would show when a user touches a cell.
i.e.... if they click on "Denmark" then a new view would show saying "Cheerioz!"


Everything in the cell is from a plist.

What I would like to do is when a user clicks on the cell, the same data will be passed onto the New View.... i.e. Publisher, Name, Icon will show into the new view.
The advice that I got was to load the plist into an NSArray using -initWithContentsOfFile: and the path to the file in the bundle.
Then, in "didSelectRow..." , say the indexPath.row is 1. To access the Publisher of Item 1 (the second item), you would want the second element of the array, and of that element (which is a dictionary), you want the object whose key is "Publisher" .
I would write this... myLabel.text = [[array objectAtIndex: indexPath.row] objectForKey
_______________________________________________________________
The coding that I have right now in the "didSelectRow...." (this is in the RootViewController.m)
Code:
{
NSString *publisher = [[NSBundle mainBundle] pathForResource:@"Appetizer" ofType:@"plist"];
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
dvController.publisher = publisher;
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
}
Question... will I be loading the plist using "initWithContentsOfFile" in the "didSelectRow..."?
And can anyone give me a tip on how I would write the "myLabel.text...." in the "didSelectRow"???
Thanks!
I would greatly appreciate any advice!!!
Last edited by a moderator: