0

我有一個模式的風格UIModalPresentationFormSheet視圖,其中呈現UIImagePickerControllerSourceTypeCamera。表單模式視圖是從自定義視圖控制器容器提供的iPad的UIImagePickerControllerSourceTypeCamera強制旋轉導致不正確的父親模態視圖的原點

圖像選擇器強制應用程序更改爲縱向。如果應用程序旋轉到肖像模式,然後圖像選擇器被解散,那麼一切正常。

但是,在設備處於橫向狀態時圖像選擇器被解散後,現在將表單樣式模式視圖放置在其父框架的左上角(請參閱圖像)。

orientation changes

我猜想,模態視圖的上海華盈是不是在後臺旋轉。然而,一旦圖像選擇器被解散,模態視圖的框架被設置爲如果它是。

回答

0
Create a custom class of UIImagePickerController. Override supportedInterfaceOrientations meted 
- (NSUInteger) supportedInterfaceOrientations 
{ 
    //Because your app is only landscape, your view controller for the view in your 
    // popover needs to support only landscape 
    return UIInterfaceOrientationMaskAll; 
} 
-(BOOL)shouldAutorotate{ 
    return yes; 
} 

//call custom view like this 
    CustomImagePickerViewController *picker = [[CustomImagePickerViewController alloc] init]; 
     picker.supportedInterfaceOrientations= UIInterfaceOrientationMaskAll; 
     picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
     picker.delegate = self; 
     [self presentViewController:picker animated:YES completion:nil];