title: How to set the delegate with a storyboard
body: <p>I've been debating with this for a while now, hope you can help me.</p>
  
  <p>I've been creating an app using storyboards mostly, I have a point where I popup a modal box to add a new record, popup works fine, the problem is dismissing it.</p>
  
  <p>I've followed Apple's instructions on how to properly close modal boxes using delegates, and that works fine, except I need to add a navigation controller to my modal box, because the add process requires two steps (here <a href="https://i.stack.imgur.com/nrDCK.png" rel="nofollow noreferrer">fullscreen</a>):</p>
  
  <p><img src="https://i.stack.imgur.com/nrDCK.png" alt="enter image description here"></p>
  
  <p>The problem lies in setting the delegate, so here are my two questions:</p>
  
  <p>1- In my root view class (My Tab) is a delegate of the Add class (the modal), everything is set up right except this:</p>
  
  <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([[segue identifier] isEqualToString:@"showAdd"]) {
          [[segue destinationViewController] setDelegate:self];
  
      }
  }
  </code></pre>
  
  <p>The problem lies in that [segue destinationViewController] is returning the navigationcontroller and not the AddDrinkViewController class (see the storyboard). How do I get around this? If I remove the navigation controller altogether, the code works fine setting the appropriate delegate.</p>
  
  <p>2- Is there any way to set the delegate by dragging the outlets in the storyboard?</p>
  
  <p>Thanks!</p>