title: respondsToSelector: not working for delegate
body: <p>I am new to iOS world and have run into an issue while trying to pass a value from a TableView back to the home controller.   </p>
  
  <p>The scenario that I am working on is </p>
  
  <ol>
  <li>Home Controller has a button</li>
  <li>Click of button opens a list of items in the second UIViewController</li>
  <li>User selects an item from list </li>
  <li>Selected item is added to another list on Home Controller</li>
  </ol>
  
  <p>Really appreciate any pointers for this issue:</p>
  
  <p>This is how I am preparing for Segue on Home</p>
  
  <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
      UIViewController *destination = segue.destinationViewController;
      if ([destination respondsToSelector:@selector(setDelegate:)]) { 
          [destination setValue:self forKey:@"delegate"];
      }
  
  }
  </code></pre>
  
  <p>SecondController has a delegate id, so I am assuming that delegate is set as "<code>respondsToSelector</code>" returns true for "setDelegate"</p>
  
  <p>Now, in SecondController when user selects an item I call <code>didSelectRowAtIndexPath</code> &amp; <code>viewWillDisappear</code> methods to set the item and make the view disappear: </p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
      POSAllItemsCell *cell = (POSAllItemsCell *) [tableView cellForRowAtIndexPath:indexPath];
  
      item = [NSDictionary dictionaryWithObjectsAndKeys:cell.name, @"Name", cell.price, @"Price", cell.code, @"Code", nil];
  
      [self dismissViewControllerAnimated:YES completion:NULL];
  
  }
  
  - (void)viewWillDisappear:(BOOL)animated { 
      [super viewWillDisappear:animated]; 
  
      if ([delegate respondsToSelector:@selector(setSelection:)]) {
          [delegate setValue:item forKey:@"selection"];
      }
  }
  </code></pre>
  
  <p>Now the problem here is that <code>respondsToSelector</code> for <code>setSelection</code> returns false even though I do have setSelection method in my HomeController:</p>
  
  <pre><code>- (void) setSelection:(NSDictionary *)dict {
      if (![dict isEqual:selection]) {
          ......
      }
  }
  </code></pre>
  
  <p>Apologies in advance if my question in not clear or is not well formatted. BTW this is for iOS 5 with Xcode 4.2</p>