gpt4 book ai didi

objective-c - 弹出错误 - [UIPopoverController dealloc] 在弹出窗口仍然可见时到达

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:04:03 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
UIPopovercontroller dealloc reached while popover is still visible

我正在创建一个通用应用程序并尝试从相机胶卷中选择一张图片。在 iPhone 上工作正常,iPad 需要一个弹出窗口,所以已经这样做了,现在不断出现错误

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

我研究过:

Stack Link

Stack Link

和谷歌,没有什么能解决这个问题

卡住了,感谢任何建议

我在 .h 中实现了 popover 委托(delegate)

.m

 - (void)logoButtonPressed:(id)sender /////////////iPad requires seperate method ////////////////
{

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {

LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
////////
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
////////
[self presentModalViewController:imagePicker animated:YES];


}

else

{

// We are using an iPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popoverController.delegate=self;


[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


}


}

我现在也试过这个:

.h

 @property (strong) UIPopoverController *pop;

.m

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {            ///code added

LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];


///code added////////////////////////////

}

else {

if (self.pop) {
[self.pop dismissPopoverAnimated:YES];
}
// If usingiPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];


[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com