我使用UIImagePickerviewController
通过以下附加代码打开照片库...在调用位代码行之后。应用程序崩溃了......它在ios5
UIImagePickerController* content = [[UIImagePickerController alloc] init];
content.delegate = self;
content.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:content animated:YES];
[content release];
这段代码有什么问题吗?
答案 0 :(得分:0)
检查Crash on presenting UIImagePickerController under ios6您将获得使UIImagePickerviewController
在iOS 6.0上工作所需的一切。
答案 1 :(得分: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];
}
答案 2 :(得分:0)
我有同样的问题。因为UIImagePicker
在纵向模式下显示。
我通过继承UIImagePicker
并实现shouldAutorotate
方法来修复它,如:
- (BOOL)shouldAutorotate
{
return NO;
}
我已经创建了我的子类imagePicker而不是UIImagePicker
的实例,一切正常。希望这会对你有所帮助。