Reputation: 22939
I have a Storyboard like this:
-- initial --> [PictureListViewController] ----> [PictureDetailViewController]
Now I want to set the delegate of my ViewController PictureListViewController
. Since it is the first ViewController I can't do this in the method -(void)prepareForSegue:...
since I the initial ViewController is created by the Storyboard framework.
For re-usability I also don't want the PictureListViewController
so set it's own delegate
.
What is the best practise for this. I could of course create another "empty" ViewController which then segues to the PictureListViewController
but this does not feel like the right thing to do for me.
Your help is very welcome. Thanks :-)
Upvotes: 4
Views: 979
Reputation: 9021
You could set this in the App Delegate by grabbing a reference to your root view controller using...
YourFirstViewController *ctr = self.window.rootViewController;
// Do stuff here
Upvotes: 5