0

我有一个 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.

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

提前致谢

4

1 回答 1

2

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

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

并呈现...

 [popOverController presentPopoverFromRect:yourframe inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
于 2013-08-20T18:52:09.327 回答