Push controllers for a plist populated table view
I now have a project where I’ve figured out how to take a plist and populate a table view with it. This way I get an easily editable list populating the cells. I have a push controller set up to push the next viewcontroler. The only problem is that touching any cell populated from the plist brings up the same view controller. Now this should be fixed with a nice if statement I’m just not sure of the syntax.
If x = cell list item { push the view} else check the next cell and see if it matches another viewcontroler to be pushed. Do this until all cells have been checked.
Please excuse this being so simplistic but I need my code in front of me and I’m at work on a pc so I can’t put it开发者_StackOverflow中文版 down exactly but I think you get the drift of what I’m trying to do.
If firstcell = name of first cell {pushtheview of view controller named the same as the populated firstcell.}
Well I figured it out and it works flawlessly. I didn't realize that strings needed isEwualToString and not == to work. Here is a little snippet of what i was doing.
if([[dictionary objectForKey:@"Apple"] isEqualToString:@"Apple"]) {
AppleViewController *appleViewController = [[AppleViewController alloc] initWithNibName:@"AppleViewController" bundle:nil];
[self.navigationController pushViewController:appleViewController animated:YES];
[appleViewController release];
}
Much happier now, on to bigger things now.
精彩评论