0
我有一个iPad应用程序,创建在XCode 4.6.3,iOS 6.2,ARC和故事板。无法解雇从另一个类的UIPopover
我在SubViewData.m中以编程方式创建UIPopover。
@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];
当弹窗中的UIButton被点击时,我在另一个类(QuickAppointment.m)中设置通知。我收到通知并从CalendarViewController.m发出此代码:
SubViewData *svd = [[SubViewData alloc] init];
[svd.popover dismissPopoverAnimated:YES];
没有任何反应!我不明白为什么不......所以,我做错了什么?
我试着把SubviewData.m中的解雇代码,但没有任何反应,然后......在哪里应该解雇的代码是什么?以及如何到达SubViewData的实例而不创建新的? (我以为我做的是正确的方式,但显然不是).. – SpokaneDude
因为我不知道你是怎么添加到SubViewData.m中的,所以我不能帮上忙。至于获得正确的实例 - 你可以这样做,就像你为任何事物获取实例一样;通过传递一个对象来引用它的方法。 – Abizern
我试过(通过参考)...这是我用的: [SubViewData.popover dismissPopoverAnimated:YES]; 它不知道什么_popover_是... 你能给我一个文档,我可以做一些阅读这个整个实例化的东西吗?我真的很感激。我正在努力... – SpokaneDude