1

我正在为 iPad 构建一个应用程序,但对于 ARC 为何要释放这样声明的强大属性有点困惑:

@property (nonatomic, strong) UIPopoverController *imagePickerPopover;

我正在使用这个 UIPopoverController 来显示用户图像库,因为如果你的 iPad 构建,你必须这样做。有人经历过吗?它只给我这个错误:

*** Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'

当我打开它时随机。(例如,我可能可以毫无例外地打开画廊一次,但不能两次或三次,但第四次它会抛出异常)这真的很奇怪。

这是我创建选择器的代码:

self.imagePickerPopover = [[UIPopoverController alloc] initWithContentViewController:picker];
[self.imagePickerPopover presentPopoverFromRect:aUIButton.frame inView:aUIButton.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
4

1 回答 1

1

所以事实证明,我实际上是想让那个选择器在打开时弹出不止一次。所以我只是使用 isPopoverVisible 属性来检查,如果不是,那么我创建并显示了弹出框。问题已解决。

于 2012-06-19T23:32:27.907 回答