我正在开发一款适用于iPhone的相机应用,但它在iPad上遇到了麻烦。我看不到iPad模拟器相册中的任何照片,也无法导入任何图像。
- (void)onPhoto{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
[self presentViewController:viewController animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *importImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"importImage is %f, %f",importImage.size.width, importImage.size.height);
}
在imagePicker关闭后我没有得到任何东西,宽度和高度都是0.0。如果我将imagePicker编辑选项设置为
imagePicker.allowsEditing = YES;
它会起作用。但我不需要这个选项。所以任何人都知道如何解决Xcode 7上的问题。谢谢。