1

我需要一個UIImagePickerCOntroller,以便用戶可以拍一些照片。這是我的代碼:UIImagePickerController不總是全屏(奇怪的狀態欄行爲)

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ 

    UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; 
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    imagePicker.delegate = self; 
    imagePicker.showsCameraControls = YES; 
    imagePicker.allowsEditing = YES; 
    imagePicker.modalPresentationStyle = UIModalPresentationFullScreen; 


    [self presentViewController:imagePicker animated:YES completion:nil]; 

} 

我第一次打開UIImagePickerController一切正常!但第二,第三......時間我總是得到這樣的:

enter image description here

正如你所看到的相機控制上述被削減。它看起來像StatusBar是問題。我什麼都試過,如:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{ 
    [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
} 

[[UIApplication sharedApplication] setStatusBarHidden:YES]; 

但毫無效果。也許是Apple Bug?

回答

0

試試這個:

  • 進入Info.plist的
  • 設置狀態欄最初是隱藏的是
  • 設置基於控制器的視圖狀態欄外觀NO
+0

感謝您的迴應,但沒有任何改變... – Davis

+0

@Davis你仍然發現狀態欄? – Mayur

+0

有沒有狀態欄,當我打開UIImagePickerController,但仍然像上面screenhot黑色區域...也許狀態欄不是問題.. – Davis

0

在實施- (BOOL)prefersStatusBarHidden您視圖控制器並根據當前條件返回YESNO。當您想要隱藏/顯示時,請在您的視圖控制器上撥打- (void)setNeedsStatusBarAppearanceUpdate

+0

感謝您的迴應,它沒有改變任何東西...... – Davis