PDA

View Full Version : I want to pass IndexPath to other view




okskpark
Oct 14, 2008, 10:59 AM
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.)



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?



lucasgladding
Oct 14, 2008, 01:46 PM
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

okskpark
Oct 14, 2008, 08:22 PM
Thank you so much. I solve my problem. Thank you.