2012-09-26 2 views
0

많은 수의 뷰가있는 popover (UIPopoverController)가있는 iPad 앱이 있습니다. 그 중 하나에는 카메라를 시작하는 버튼이 있습니다 ... 이미지보기 ... .팝업에서 전체 화면 모달을 열면 카메라의 화면 배치가 잘못되었습니다.

enter image description here

카메라는이 방법으로 유발되는 ...

- (IBAction)selectPlanImageFromCamera:(id)sender 
{ 
    [self.blockTextField resignFirstResponder]; 
    [self.levelTextField resignFirstResponder]; 
    [self.zoneNamePrefixTextField resignFirstResponder]; 
    [self.nameTextField resignFirstResponder]; 
    [self.notesTextView resignFirstResponder]; 

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

    [self presentViewController:imagePicker animated:YES completion:^{}]; 
} 

모든 작품이 위치하도록 사실에서 부품을 기대하는 나는 다음 표시되는 전체 화면 모달 카메라보기를 얻을 s보다 약간 낮다. 크렌 경계. 이 응용 프로그램은 이제 대상으로 동안이

enter image description here

... 이미지보기 ... 맨 아래에있는 컨트롤을 20 픽셀 남쪽 화면이며, 화면 상단에 20 픽셀 검은 색 밴드가 있다는 것을 의미 iOS6에서 이전에 iOS5와 동일한 효과를 얻었습니다. 누구든지 해결 방법이나 수정 방법을 생각할 수 있습니까?

미리 감사드립니다. Michael.

+0

뷰 계층 구조의 상위에서 제시해야 할 수도 있습니다. 대리인 전화 나 알림 센터를 사용하여 더 높은 VC에서 표시하려고 할 수 있습니다. – shawnwall

+0

포인터 'shawnwall'주셔서 감사합니다 - 이것은 나를 올바른 방향으로 인도합니다. 결과 솔루션으로 답변을 게시하겠습니다. – Michael

+0

비슷한 문제가 있습니다 ... [[UIApplication sharedApplication] setStatusBarHidden : YES withAnimation : UIStatusBarAnimationNone]을 사용하여 해결했습니다. –

답변

0

shawnwall의 주석에서 원래의 질문에 이르기까지 포인터를 따라 가면서 루트 UIViewController에서 presentViewController 메서드 호출을 수행 한 다음 UIPopoverController를 해체하고 다시 설정하여 사진을 찍는 중 한쪽을 수정하여이 문제를 해결했습니다.

그래서, 카메라 뷰를 선동 내 방법 ...이 (마지막 두 줄이 새로운 주 - 첫 번째 줄은 팝 오버를 일축하고, 두 번째 줄은 주요 루트의 UIViewController에 UIImagePickerController를 선물)

- (IBAction)selectPlanImageFromCamera:(id)sender 
{ 
    [self.blockTextField resignFirstResponder]; 
    [self.levelTextField resignFirstResponder]; 
    [self.zoneNamePrefixTextField resignFirstResponder]; 
    [self.nameTextField resignFirstResponder]; 
    [self.notesTextView resignFirstResponder]; 

    cameraImagePicker = [[NonRotatingUIImagePickerController alloc] init]; 
    cameraImagePicker.allowsEditing = NO; 
    cameraImagePicker.delegate = self; 
    cameraImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    cameraImagePicker.modalPresentationStyle = UIModalPresentationFullScreen; 
    cameraImagePicker.showsCameraControls = YES; 

    [mainCanvasViewController.sitePopoverController dismissPopoverAnimated:YES]; 
    [mainCanvasViewController presentViewController:cameraImagePicker animated:YES completion:^{}]; 
} 

난 후 다시 현재의 아무 곳이나 팝 오버가 나는 UIImagePickerController를 기각하고 -

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
    if ([info objectForKey:UIImagePickerControllerMediaType] == (NSString *)kUTTypeImage) 
    { 
     ... // image handling 
    } 

    [picker dismissViewControllerAnimated:YES completion:^{}]; 

    UIBarButtonItem *tappedButton = mainCanvasViewController.navigationItem.leftBarButtonItem; 
    [mainCanvasViewController.sitePopoverController presentPopoverFromBarButtonItem:tappedButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
} 

이 잘 작동 (위에서 설명한 것과 같은 UIViewController에 단위) didFinishPickingMediaWithInfo의 대리자 메서드에이 경우에는 - 클 팝업 뷰를 다시 표시하는 것은 팝업이 화면 하단에서 움직이는 동안 팝업이 다시 나타나면 조금 더 깔끔하게 나올 수 있습니다. 카메라가 전환 된 후에 팝 오버가 나타나면 더 멋지게 보일 것입니다. 나에게 이것은 지금 큰 문제가 아니다.

희망 사항은 UIPopoverController에서 전체 화면 카메라 UIImagePickerController를 열고 자하는 사람에게 도움이되기를 바랍니다.

친절히, 마이클.

1

우리는 이것이 상태 표시 줄 높이 인 20px과 어떻게 든 관련이 있다고 생각했습니다. 우리의 추측은 맞았고, 아래 코드는 UIIMagePickerController이 표시되어있는 동안 상태 표시 줄을 숨기는 우리를 위해 일했습니다. imagePickerControllerDidCancel, didFinishPickingMediaWithInfofinishedSavingWithError - :

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
imagePicker.delegate = self; 
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage,nil]; 
imagePicker.allowsEditing = NO; 

if (IS_IPAD) 
{     
    imagePicker.modalPresentationStyle = UIModalPresentationFullScreen; 
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; 

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

하나는 다음 대표의 각각에 아래 코드를 추가해야 할 수도 있습니다.

if (IS_IPAD) 
{ 
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; 
} 
0

UIImagePickerController를 인스턴스에게 프리젠 테이션 스타일을 말해이 버그가 해결됩니다

cameraImagePicker.modalPresentationStyle = UIModalPresentationFullScreen;

을보십시오.