I am not able to figure out why the popoverControllerDidDismissPopover is not being called.
I have searched and I am not calling to dismiss the popover via animation, and I think I have all the delegate information correct.
The Code below is for the setting up of the segues, and what should happen when it the the user is done picking the selection.
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
UIStoryboardPopoverSegue *popoverSegue;
popoverSegue=(UIStoryboardPopoverSegue *)segue;
UIPopoverController *popovercontroller;
popovercontroller = popoverSegue.popoverController;
popovercontroller.contentViewController.title = segue.identifier;
popovercontroller.delegate = self;
_popoverController.delegate = self;
NSLog(@" %@",segue.identifier);
if ([[segue identifier] isEqualToString:@"PISegue"]){
PIViewController *PrimVC;
PrimVC=(PIViewController *)popovercontroller.contentViewController;
}
if ([[segue identifier]isEqualToString:@"LASegue"]) {
LAViewController *LearnVC;
LearnVC=(LAViewController *)popovercontroller.contentViewController;
}
}
-(void) popoverControllerDidDismissPopover:(UIPopoverController *)popoverController{
NSLog(@"Popovercontroller did dismiss method called.");
NSString *temp;
if ([popoverController.contentViewController.title isEqualToString:@"PISegue"]) {
temp = ((PIViewController *)popoverController.contentViewController).selected;
_primaryInterestTextField.text = temp;
NSLog(@"PI: %@",temp);
[_primaryInterestButton setTitle:@"" forState:UIControlStateNormal];
}
if ([popoverController.contentViewController.title isEqualToString:@"LASegue"]) {
temp = ((LAViewController *)popoverController.contentViewController).selected;
_learnAboutTextField.text = temp;
NSLog(@"LA: %@",temp);
[_learnAboutButton setTitle:@"" forState:UIControlStateNormal];
}
}
Is there any chance you did not include the
UIPopoverControllerDelegate
in your header file? If so, adding it should fix the problem.