gpt4 book ai didi

ios - UIPickerController 使应用程序崩溃

转载 作者:行者123 更新时间:2023-11-28 22:28:02 25 4
gpt4 key购买 nike

我有一个 UIPickerController 可以获取你的照片并允许你选择其中的一些照片,尽管在我单击按钮激活它的那一刻,应用程序崩溃了。

这是我使用的代码:

在我的 ViewDidLoad 方法中:

pickerController = [[UIImagePickerController alloc] init];
pickerController.allowsEditing = NO;
pickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

函数:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:nil];
patientPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImageView *pictureView = (UIImageView *)[imageCell viewWithTag:777];
pictureView.image = patientPicture;
[_imgViewAdd reloadInputViews];
}

它被称为:

- (IBAction)addPicture:(id)sender {
[self presentViewController:pickerController animated:YES completion:nil];
}

这很奇怪,因为我最近只将我的应用程序更改为 Ipad,尽管它在 iPhone 中运行良好。当您单击 NSLog 中的按钮时,会出现此错误消息,我认为这与它有关:

UIStatusBarStyleBlackTranslucent is not available on this device.

我怀疑这是人们普遍存在的问题

提前致谢

最佳答案

尝试在弹出窗口中呈现...

pickerController = [[UIImagePickerController alloc] init];
UIPopoverController *popOverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
popOverController.delegate = self;

并呈现...

 [popOverController presentPopoverFromRect:yourframe inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

关于ios - UIPickerController 使应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18342778/

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