title: Custom Delegate, dismiss popover from another view
body: <p>I could use some help with custom delegates.  I'm trying to make a protocol that sends a message to its delegate to dismiss the popover view.  Here is what I'm trying.</p>
  
  <p>In the popoverViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  
  @protocol MyPopoverDelegate &lt;NSObject&gt;
  -(void) didSelectLanguage;
  @end
  
  
  
  @interface Popover : UITableViewController{
  
      id &lt;MyPopoverDelegate&gt; delegate;
      NSMutableArray *languageData;
  
  }
  
  @property (nonatomic, assign) id &lt;MyPopoverDelegate&gt; delegate;
  
  @end
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>@synthesize delegate;
  
  ...
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
      NSLog(@"You selected %@", [languageData objectAtIndex:[indexPath row]]);
      [self.delegate didSelectLanguage];
  
  }
  
  ...
  </code></pre>
  
  <p>And in the ViewController that presents the popover</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "popoverViewController.h"
  
  
  
  
  @interface ChoicesChoices : UIViewController &lt;UIPopoverControllerDelegate, MyPopoverDelegate&gt;{
  
      UIPopoverController *popover;
  
  
  
  
  }
  - (IBAction)facebook:(id)sender;
  - (IBAction)twitter:(id)sender;
  - (IBAction)sms:(id)sender;
  - (IBAction)copy:(id)sender;
  - (IBAction)email:(id)sender;
  - (IBAction)home:(id)sender;
  - (IBAction)mute:(id)sender;
  - (IBAction)note:(id)sender;
  
  
  @property (nonatomic, retain) UIPopoverController* popover;
  
  
  @end
  </code></pre>
  
  <p>and .m</p>
  
  <pre><code>@synthesize popover;
  
  ...
  
  - (void)didSelectLanguage{
  [popover dismissPopoverAnimated:YES];
  NSLog(@"didSelectLanguage fired");
  }
  </code></pre>
  
  <p>When I select a row in the table of the popover, didSelectLanguage does not get called.  Any ideas on what I might be doing wrong?  Thanks for your help.</p>