0

我正在使用UIImagePickerviewController通过以下附加代码打开照片库...在调用位代码行之后。应用程序崩溃了......它工作正常ios5

UIImagePickerController* content = [[UIImagePickerController alloc] init];
content.delegate = self;
content.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:content animated:YES];
[content release];

这段代码有什么问题吗?

4

3 回答 3

0

Check Crash on presenting UIImagePickerController under ios6 You will get everything you need to make UIImagePickerviewController working on iOS 6.0.

于 2012-11-08T11:19:30.310 回答
0
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
  popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
  [popover presentPopoverFromRect:cameraButton.frame inView:self.view  
  permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
else{
 [self presentModalViewController:imagePicker animated:YES];
}
于 2012-11-08T11:30:27.580 回答
0

我遇到过同样的问题。因为UIImagePicker在纵向模式下显示。UIImagePicker我通过子类化并实现如下shouldAutorotate方法来修复它:

- (BOOL)shouldAutorotate
{
    return NO;
}

我已经创建了我的子类 imagePicker 的实例而不是UIImagePicker,一切正常。希望这会帮助你。

于 2012-11-08T12:03:01.493 回答