UIPopoverController:当弹出窗口仍然可见时达到dealloc [英] UIPopoverController: dealloc reached while popover is still visible
问题描述
我正在开发一款可让用户从自己的相册中选择图片的应用。它适用于iPhone,但不适用于iPad。
I am working on an app that lets the user select images from his own photo album. It works on iPhone, but not on iPad.
我做了一个 UIPopoverController
,一切正常,用户可以选择一张照片,但是当用户按USE按钮。应用程序兑现了一个说法
I made a UIPopoverController
, and it all works fine, the user can pick a photo, but when the user pushes "USE" button. the app cashes a says
UIPopoverController dealloc]当popover仍然可见时
UIPopoverController dealloc] reached while popover is still visible
这里是代码:
- (void)choosePhotoFromLibraryipad:(id)sender{
if(![popoverController isPopoverVisible]){
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.popoverController presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES ];
}
}
推荐答案
检查 .h
文件。确保 popoverController
的 @property
为 strong
而不是弱
。一个小时的时间浪费在这样的简单事情上。
Check your .h
file. Make sure that your @property
for your popoverController
is strong
instead of weak
. Many an hour of time has been wasted over simple things like this.
这篇关于UIPopoverController:当弹出窗口仍然可见时达到dealloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!