I want to pass IndexPath to other view

Discussion in 'Mac Programming' started by okskpark, Oct 14, 2008.

  1. okskpark macrumors newbie

    Joined:
    Jul 26, 2008
    Location:
    Seoul, South Korea
    #1
    I have a table view(view A). And when I click a row, it makes other view('view B) and push it to navigation controller.

    The problem is I want to know which row, which is in view A, is clicked from view B
    (...Now I'm confused about prepositions. :( sorry. English is not my mother tongue. I hope you understand.)


    Code:
    	aTableView = [[ATableViewController alloc] initWithStyle: UITableViewStyleGrouped];
    	[[self navigationController] pushViewController:aTableView animated:YES];
    
    I used an init function with 'initWithStyle'.
    So, I think, I can not make my own initializer that can pass the indexpath or sth through arguments.

    How can I know the row in view B?
     
  2. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #2
    There are a couple ways, but your best bet is simply to create an instance variable in the second view controller for the selected object. You can then set that before you push the second view controller. You probably don't need the indexPath, but rather the represented object.

    Kind regards
     
  3. okskpark thread starter macrumors newbie

    Joined:
    Jul 26, 2008
    Location:
    Seoul, South Korea
    #3
    Thank you so much. I solve my problem. Thank you.
     

Share This Page