shouldAutorotateToInterfaceOrientation in ios6

时间:2012-11-08 11:02:05

标签: ios uinavigationcontroller uiinterfaceorientation

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

中工作正常
UIImagePickerController* content = [[UIImagePickerController alloc] init];
content.delegate = self;
content.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:content animated:YES];
[content release];

这段代码有什么问题吗?

3 个答案:

答案 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的实例,一切正常。希望这会对你有所帮助。