views:

100

answers:

2

Hi,

I'm doing a iPhone app.

I created my own SwitchViewController Class (linked to the App-Delegate) which actually just changes the various other Views / ViewControllers (e.g ViewA, ViewB) while the app is running.

When I know recieve a tap-gesture in the ViewController-A I would like to trigger a method (eg. switchViews:(id)sender) in the SwitchViewController Class.

What would the best way to do this? Must I initiate ViewA with a object-reference to SwitchViewController? Delegate? What would be the best way?

When I add a button to ViewA its no problem, then I just can connect it to the IBOutlet. But programmatically?

Thanks, Stefan

+2  A: 

Sounds like a prime example for using the NSNotificationCenter.

DarkDust
A: 

Used actually the responder chain, and recieved the tap in the switchViewController.

Stefan