所以我正在编写这个 iPad 应用程序,它从主屏幕开始,然后你可以从那里转到设置页面。UIImagePickerController
在设置页面中,您可以使用弹出视图从相册中选择图片。
如果我进入设置页面,然后按后退按钮返回主页,一切都会按预期工作。但是如果我去设置并选择一个图像页面上的后退按钮不会让我回到主页。
弹出窗口UIImagePickerController
似乎工作正常,所以我不知道是什么原因造成的。这是我的代码UIImagePickerController
。
- (IBAction)imagePick1:(id)sender {
pickerController = [[UIImagePickerController alloc] init];
[pickerController setDelegate:self];
[pickerController setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
[pickerController setAllowsEditing:NO];
popoverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
[popoverController setDelegate:self];
[popoverController presentPopoverFromRect:[[self imageButton1] frame] inView:[self view] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
...
- (void)imagePickerController:(UIImagePickerController *)pickerController1 didFinishPickingMediaWithInfo:(NSDictionary *)info
{
image1 = [info objectForKey:UIImagePickerControllerOriginalImage];
_image1.image = image1;
[popoverController dismissPopoverAnimated:YES];
}
当我尝试按下后退按钮时,应用程序冻结并且不再响应任何命令。我究竟做错了什么?
编辑:我再次运行它,这是按下后退按钮时我在日志中遇到的错误。
-[__NSCFType dismissPopoverAnimated:]: unrecognized selector sent to instance 0x7128cd0
这也是我的头文件的开头。
@interface ViewController : UIViewController
<UIPickerViewDataSource, UIPickerViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPopoverControllerDelegate>{
UIPopoverController *popoverController;
}
@property (nonatomic, retain) UIPopoverController *popoverController;