I have a table view which uses a fetchedResultsController to manage a series of 'Venue' objects from core data. When you select one of the rows on the table view, it passes the current Venue object to a new view (via prepareForSegue), which displays details of the Venue object: name, address, images etc. This all works fine.
I have something I want to achieve but I'm not sure the best or most conventional way to do it. I would like the same behaviour as above, but with a map view sandwiched in between the initial table view and the detail view. So the navigation stack looks like this:
table view (showing all Venues) -> map view (showing all Venues) -> detail view (showing one selected Venue)
Presently I have a button from the table view which segues to the map view, passing an array of annotations which are then plotted on the map. The annotations don't contain all the Venue information, they are just assigned a title and subtitle from each Venue. Each annotation shows a detail disclosure button linking to the detail view. However I am conceptually stuck as to how to pass the relevant Venue object (currently only available in my table view) to the detail view when selected from the map view.
My assumption is that I need to do something along these lines: pass all the Venue objects from my table view to my map view, and just have them existing in the background but not being used. Then when a disclosure button is pressed, the map view checks somehow which Venue matches the selected annotation (checking if the title attribute matches perhaps?) and passes that onto the detail view as the 'selected Venue'. However I don't know how best to do this in practice or even if I have the right idea. Is it possible for my annotation to contain the entire related Venue object? Or for the detail view to somehow ask the initial table view for data?
Hope I'm explaining this clearly enough. Sorry its a bit wordy. I'm still fairly new to Xcode and understand that I may be overlooking something very simple, or making a fundamental error somewhere. Any advice would be much appreciated though!