Ios 我正在尝试使用UIPopoverContoller加载图像
我在xcode 4.2中制作了一个简单的通用图像加载器,它允许您从手机库中选择一张照片并将其显示在屏幕上。这是一款通用应用程序,使用UIImagePickerController可以打开菜单并选择照片,但当用户单击ipad上应显示popoverController按钮的按钮时,会返回一个错误Ios 我正在尝试使用UIPopoverContoller加载图像,ios,uipopovercontroller,Ios,Uipopovercontroller,我在xcode 4.2中制作了一个简单的通用图像加载器,它允许您从手机库中选择一张照片并将其显示在屏幕上。这是一款通用应用程序,使用UIImagePickerController可以打开菜单并选择照片,但当用户单击ipad上应显示popoverController按钮的按钮时,会返回一个错误 #import "ImageLoaderViewController.h" @implementation ImageLoaderViewController @synthesize imageView
#import "ImageLoaderViewController.h"
@implementation ImageLoaderViewController
@synthesize imageView = _imageView;
@synthesize popoverController;
-(void)selectPhoto
{
NSLog(@"YYOYOYOYOY");
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
NSLog(@"now i am here");
imagePicker.delegate = self;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
NSLog(@"camera");
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
else{
NSLog(@"NO camera");
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;}
if(IS_IPHONE)
{
NSLog(@"is an iphone");
[self presentModalViewController:imagePicker animated:YES];
}
else
{
if ([popoverController isPopoverVisible])
[popoverController dismissPopoverAnimated:NO];
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
popoverController.delegate = self;
[popoverController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
}
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
_imageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
if(IS_IPHONE)
[self dismissModalViewControllerAnimated:NO];
}
-(void) popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
{
[popoverController dismissPopoverAnimated:NO];
}
@end
它没有说错误,或者如果是这样,我不知道如何检查,但断点是我展示popoverController的地方。