4

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 :-)

1 Answer 1

5

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 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.