View Full Version : NSArray, UITableView & Detail view question
lildragon
Jun 23, 2009, 12:30 PM
Hiya guys, I'm in need of a bit of help with something I'm trying to accomplish.
I'm following James brilliant tut here http://www.vimeo.com/4934632 and got everything working with the detailViewController and NSArray and so fourth. But now I would like to have each cell select a different DetailView .nib and I'm not sure how to do that from an Array... Any help would be greatly appreciated.
BTW apple's sample Navbar code does what I need, I just need some help breaking this down.
Cheers,
~t
namanhams
Jun 23, 2009, 10:23 PM
Do you mean each cell in the table view now if selected will push a different view controller, instead of all cells push the same view controller ?
lildragon
Jun 23, 2009, 10:32 PM
Yes exactly! I've been playing around with Apple's sample code UICatalog (http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html) And this actually seems better. I've been studying their source code and came up with something like this
// for table 1:
Article1DetailViewController *article1DetailViewController = [[Article1DetailViewController alloc]
initWithNibName:@"Article1DetailViewController" bundle:nil];
[self.tableDataList addObject:[NSDictionary dictionaryWithObjectsAndKeys:
article1DetailViewController, kViewControllerKey,
nil]];
[Article1DetailViewController release];
[self.navCont pushViewController:article1DetailViewController animated:YES];
It's fuzzy to say the least, any ideas/tips?
thx!
~t
namanhams
Jun 24, 2009, 12:27 AM
Then in the code that you handle the cell tap event, you just load the corresponding view controller from Nib file and then push onto the navigation controller. Am i rite ?
lildragon
Jun 24, 2009, 07:27 AM
Pretty much yeah...
lildragon
Jun 24, 2009, 08:30 PM
Well I got it working.. mostly with the above code and picking apart the UICatalog code from Apple. Works great now..
Cheers
Greg Levy
Jul 1, 2009, 08:14 PM
Could you please email me your code so I can get an idea on how to do this? Or post it?
Thanks
Greg
gregrlevy@aol.com
lildragon
Jul 2, 2009, 09:28 AM
Could you please email me your code so I can get an idea on how to do this? Or post it?
Thanks
Greg
gregrlevy@aol.com
I could but it's a bit of code to post, just grab the UICatalog link I posted and sift through that. The snippet of code I posted above is important also. Any specific questions I'll try my best to answer.
Greg Levy
Jul 2, 2009, 09:18 PM
Thanks I'll give it a try.
Greg
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.