I have a iPad app, created in XCode 4.6.3, iOS 6.2, ARC and Storyboards.
I create a UIPopover programmatically in SubViewData.m.
@property (strong, nonatomic) UIPopoverController *popover;
// make rectangle to attach popover
CGRect rectangle = CGRectMake( touchPoint.x, touchPoint.y, 110, 1); // 0 height puts arrow on exact touch point
// get addressability to storyboard ViewController
UIViewController *popoverMainView = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"menuView"];
popover = [[UIPopoverController alloc] initWithContentViewController:popoverMainView];
[popover presentPopoverFromRect:rectangle inView:self
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
I set notifications in another class (QuickAppointment.m) when a UIButton in the popover has been tapped. I get the notification and issue this code from CalendarViewController.m :
SubViewData *svd = [[SubViewData alloc] init];
[svd.popover dismissPopoverAnimated:YES];
Nothing happens! I don't understand why not... so, what am I doing wrong?
Look at the code you are writing:
SubViewData *svd = [[SubViewData alloc] init];
This creates a completely new and different instance of SubViewData, and not the one that is displaying the popover.