gpt4 book ai didi

iphone - 如何使此图像选择器在iPad上工作?

转载 作者:行者123 更新时间:2023-12-01 18:26:16 25 4
gpt4 key购买 nike

我需要帮助才能使此代码在iPad上正常运行,但在iPhone上却可以正常工作,但出于某种原因,iPad却无法工作。我不知道该如何使此图像选择器在iPad上正常工作。任何帮助将不胜感激。

  -(IBAction)getCameraPicture:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsImageEditing = YES;
picker.sourceType = (sender == takePictureButton) ? UIImagePickerControllerSourceTypeCamera :
UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController: picker animated:YES];
[picker release];
}

-(IBAction)selectExitingPicture
{
if([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker= [[UIImagePickerController alloc]init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
}


}

-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage : (UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
imageView.image = image;
[picker dismissModalViewControllerAnimated:YES];
}


-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}

最佳答案

在iPad上,您需要将其显示在UIPopoverController内,而不是模态显示。

关于iphone - 如何使此图像选择器在iPad上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13533200/

25 4 0
文章推荐: java - Android 将 ArrayList 保存为 SharedPreference