NSArray, UITableView & Detail view question

Discussion in 'iOS Programming' started by lildragon, Jun 23, 2009.

  1. lildragon macrumors newbie

    Joined:
    Jun 23, 2009
    #1
    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
     
  2. namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #2
    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 ?
     
  3. lildragon thread starter macrumors newbie

    Joined:
    Jun 23, 2009
    #3
    Yes exactly! I've been playing around with Apple's sample code UICatalog And this actually seems better. I've been studying their source code and came up with something like this

    Code:
    // 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
     
  4. namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #4
    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 ?
     
  5. lildragon thread starter macrumors newbie

    Joined:
    Jun 23, 2009
  6. lildragon thread starter macrumors newbie

    Joined:
    Jun 23, 2009
    #6
    Well I got it working.. mostly with the above code and picking apart the UICatalog code from Apple. Works great now..

    Cheers
     
  7. Greg Levy macrumors newbie

    Joined:
    Mar 12, 2009
    #7
    Post code?

    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
     
  8. lildragon thread starter macrumors newbie

    Joined:
    Jun 23, 2009
    #8

    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.
     
  9. Greg Levy macrumors newbie

    Joined:
    Mar 12, 2009

Share This Page