Search code examples
iosobjective-cuistoryboardsegue

How to find the name of the view controller beneath a popover ios7


This is probably a very simple question but I can't find the answer to it.

I am working on a new project that uses Storyboards for the first time. I have a number of view controllers that connect the way I want them to. Each view controller has an info button.

I have one view controller (AboutViewController) that I want to use to display the info for all the view controllers. I am currently calling this via a popover segue from each screen. So I have one destination view controller (AVC) that I am calling from a number of VCs- VC1toAVC, VC2toAVC, VC3toAVC etc. I want two textfields in AVC to change, depending on which VC called it.

So here's the problem- how can I tell which view controller called the popup? It's basically the view that's below the popover. Currently I'm storing it as a variable but that's not ideal. I'm guessing it has something to do with the segue identifiers?

Any and all help much appreciated!


Solution

  • One approach to this is adding a property to your pop up view controller and then define the

    prepareForSegue:sender:
    

    method so you set your destination view controller's property to the sender of the segue.