So i am experimenting with segues and have just got the hand using prepareForSegue
to get the destination controller based on an identifier and pass variables up(down) the chain. However i have encountered an issue where my current segue relies on the NSIndexpath from a uitableView, and the segue is activated on pressing uitableviewcell of said table. Problem is prepareForSegue
is called before tableViewDidSelect
, the only possibly solution i can think of is using a scheduled timer...which really is not ideal and a bit messy, can anyone witha bit more know How on seagues and such to give me a hand here?
Asked
Active
Viewed 123 times
0

Genhain
- 1,937
- 1
- 19
- 38
2 Answers
0
Never mind, i found my answer here Storyboard segue gets called before UITableView's didSelectRow
essentially the answer i was looking for, is setting up a manual seague, basically a segue that only get's performed when called explicitly through code rather than action based.
0
In prepareForSegue method you can get the current selected row by
[self.tableView indexPathForSelectedRow].row
This situation is described in details in Apple's "Your second iOS App" tutorial. You can check out how the "sighting" property of a DetailViewController (in the tutorial) is being set when the segue from the MasterViewController to the DetailViewController is triggered. The segue is called "ShowSightingDetails".

FreeNickname
- 7,398
- 2
- 30
- 60