我有一个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.
我怀疑这是人们常见的问题
提前致谢
答案 0 :(得分:2)
尝试在popover中演示......
pickerController = [[UIImagePickerController alloc] init];
UIPopoverController *popOverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
popOverController.delegate = self;
并提出......
[popOverController presentPopoverFromRect:yourframe inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];