1

우선 제가 할 노력하고있어 당신에게 알려주지 :사용자가 UIImagePickerController의 소스 유형을 선택하도록 허용하는 방법은 무엇입니까?

  1. 을 사용자가 버튼을 클릭하면, 나는 같은 UINavigationControllerUIPopoverController을 제시 할 그 contentViewController (이 아이 패드에)
  2. 첫 번째 UIViewControllerUINavigationController으로 푸시됩니다. "사진 찍기"및 "라이브러리에서 선택"버튼이있는 사용자 정의보기 컨트롤러가됩니다. UIImagePickerControllersetSourceType:UIImagePickerControllerSourceTypeCamera와는 UIImagePickerController에서 "선택 라이브러리에서"버튼 것이다 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary을 감동 UINavigationController
  3. 로 밀어하고 UINavigationController

I로 밀어 것이다 "사진을 찍을"버튼을 누르면

  • 이 모든 작업을 수행 할 수 있고 UINavigationController가 허용하는대로 사용자가 뒤로 탐색 할 수 있기를 원합니다.

    UIImagePickerControllerUINavigationController이므로 # 3 및 # 4에서 설명한대로 UINavigationController으로 밀어 넣을 수 없습니다.

    질문 :

    1. 카메라/사진 라이브러리보기 컨트롤러 전에 밀어 사용자 정의보기 컨트롤러 UIImagePickerController를 사용하는 저를위한 방법이 있나요?
    2. 반대로 카메라/사진 라이브러리보기 컨트롤러에 액세스하여 다른 UINavigationController에 넣을 수있는 방법이 있습니까?
    3. 아니면 내가 여기에 완전히 빠져있는 다른 방법이 있습니까?
  • 답변

    0

    다음 코드를 추가하면 (here) 최종적으로이 문제가 해결되었습니다.

    navigationController:willShowViewController:animated: 메서드를 사용하여 탐색 모음에 액세스하십시오.

    이 코드를 사용하면 "취소"버튼을 추가 할 수 있습니다.

    if ([navigationController isKindOfClass:[UIImagePickerController class]]) { 
    
        UINavigationBar *bar = navigationController.navigationBar; 
        UINavigationItem *top = bar.topItem; 
    
        UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(imagePickerControllerDidCancel:)]; 
        [top setLeftBarButtonItem:cancel]; 
    
    } else { 
    
        //do non imagePickerController things 
    
    } 
    
    관련 문제