title: Dismiss popover on UIButton click is not working, what am I doing wrong?
body: <p>I am attempting to dismiss a popover as well as return a variable when a button is clicked in the popover. There are four buttons and on selection of a button, the variable (based on the button) will be returned to the original view controller and the popover will close. I am unsure of how to attempt the passing of the variable, but I am attempting to at least do the popover close on button click using this page (http://stackoverflow.com/questions/3565968/dismiss-popover-using-uibutton), which for some reason doesn't work for me. When I click on the button absolutely nothing happens.</p>
  
  <p>AddWineViewController is the "root" view controller</p>
  
  <pre><code>//AddWineViewController.h
  //this is the "root" view controller
  #import "WineStyleViewController.h"
  @interface AddWineViewController : UIViewController &lt;UIPopoverControllerDelegate, MyPopoverDelegate&gt;
  @property (nonatomic, retain) UIPopoverController *myPopoverController;
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>//AddWineViewController.m
  @implementation AddWineViewController
  @synthesize myPopoverController;
  -(void)didClickCancelButton {
      //I would like to have the variable passed here, something like self.wineStyle.text=wineStyle; where wineStyle is the variable from the popover.
      [myPopoverController dismissPopoverAnimated:YES];
  }
  </code></pre>
  
  <p>WineStyleViewController is the popover view controller</p>
  
  <pre><code>//WineStyleViewController.h
  @protocol MyPopoverDelegate &lt;NSObject&gt;
      -(void)didClickCancelButton;
  @end
  @interface WineStyleViewController : UIViewController
  @property (nonatomic, assign) id&lt;MyPopoverDelegate&gt; delegate; 
  @property (nonatomic, strong) NSString *wineStyle;
  - (IBAction)redWineButton:(id)sender;
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>//WineStyleViewController.m
  @implementation WineStyleViewController
  @synthesize wineStyle;
  @synthesize delegate;
  
  - (IBAction)redWineButton:(id)sender {
      wineStyle=@"Red";
      [self.delegate didClickCancelButton];
  }
  </code></pre>