我有一个按钮,它应该用UIImagePickerController创建一个popover,而不是崩溃。我没有使用ARC,我查看了很多其他条目,没有其他人帮助过。我不是过早地发布任何东西。有人有修复吗?
-(void)pickImageAction {
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
[popoverController release];
} else {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
popoverController = [[UIPopoverController alloc] initWithContentViewController:picker];
popoverController.delegate = self;
//Crashes here
[popoverController presentPopoverFromRect:CGRectMake(300, 300, 320, 480) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
}
}
-(IBAction)buttonClicked {
[self pickImageAction];
}