title: Properly accessing a segue's destination view controller to assign protocol delegates
body: <p>I'm encountering some problems in integrating segue and protocols while implementing a selection list.</p>
  
  <p>In my selection list .h I have:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @protocol SelectionListViewControllerDelegate &lt;NSObject&gt;
  @required
  - (void)rowChosen:(NSInteger)row;
  @end
  
  @interface SelectColor : UITableViewController &lt;NSFetchedResultsControllerDelegate&gt;
  -(IBAction)saveSelectedColor;
  @property (nonatomic, strong) id &lt;SelectionListViewControllerDelegate&gt; delegate;
  @end
  </code></pre>
  
  <p>In my selection list .m I have:</p>
  
  <pre><code>@implementation SelectColori
  @synthesize delegate;
  
  //this method is called from a button on ui
  -(IBAction)saveSelectedColore
  {
      [self.delegate rowChosen:[lastIndexPath row]];
      [self.navigationController popViewControllerAnimated:YES];
  }
  </code></pre>
  
  <p>I would like to access to this selection list view by performing a segue from another table view:</p>
  
  <pre><code>@implementation TableList
  ...
  - (void)selectNewColor
  {
      SelectColor *selectController = [[SelectColor alloc] init];
      selectController.delegate = (id)self;
      [self.navigationController pushViewController:selectController animated:YES];
  
      //execute segue programmatically
      //[self performSegueWithIdentifier: @"SelectColorSegue" sender: self];
  }
  
  - (void)rowChosen:(NSInteger)row
  {
      UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Error Title" message:@"Error Text" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
      [errorAlert show];
  }
  </code></pre>
  
  <p>If I navigate to the selection list using: </p>
  
  <blockquote>
    <p>[self.navigationController pushViewController:selectController animated:YES];</p>
  </blockquote>
  
  <p>the alert is displayed. If I instead use:</p>
  
  <blockquote>
    <p>[self performSegueWithIdentifier: @"SelectColorSegue" sender: self];</p>
  </blockquote>
  
  <p>no alert is displayed, because, I think, I don't pass to the destination selection list the selectController. Any ideas to solve this issue please?</p>