【问题标题】:UIPopoverController: dealloc reached while popover is still visibleUIPopoverController:在popover仍然可见时达到了dealloc
【发布时间】:2013-03-12 22:16:05
【问题描述】:

我正在开发一个应用程序,该应用程序允许用户从他自己的相册中选择图像。它适用于 iPhone,但不适用于 iPad。

我做了一个UIPopoverController,一切正常,用户可以选择一张照片,但是当用户按下“使用”按钮时。该应用兑现说

UIPopoverController dealloc] 在 popover 仍然可见时到达

代码如下:

- (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 ];

    }
}

【问题讨论】:

  • 当你想隐藏popover时,你写过[popoverController dismissPopoverAnimated:YES];吗?请说明您是否使用ARC
  • 是的,我忘了做一个 [popoverController dismissPopoverAnimated:YES];尴尬 :-D 经过这么多小时,就这么简单

标签: ios ipad uipopovercontroller popover


【解决方案1】:

检查您的.h 文件。确保 @property 对应的 popoverControllerstrong 而不是 weak。很多小时的时间都浪费在这样简单的事情上了。

【讨论】:

  • 我忘记制作 [popoverController dismissPopoverAnimated:YES] 但感谢您的回答。
猜你喜欢
  • 1970-01-01
  • 2014-09-24
  • 1970-01-01
  • 2014-10-03
  • 2014-07-16
  • 1970-01-01
  • 1970-01-01
  • 2023-03-28
  • 1970-01-01
相关资源
最近更新 更多