2017-09-20 23 views
1

이것은 내 첫 번째 질문이다. 너무 바보가되지 않기를 바란다. - ChatTableViewController
VC3 - PopupPhotoSourceVC
제시된 다른보기로 인해 View Controller가 표시되지 않았습니다. 완료되지 않았습니다.

VC1 - VC2 모달
VC2을 제시 할 수있는 버튼 - 모달 VC3을 제시 할 수있는 "바"버튼을
VC1
VC2 : 여기

내 응용 프로그램입니다 (VC3 프리젠 테이션을 "현재 컨텍스트"로 설정)
VC2 - 풀기 설정

@IBAction func unwindToChatTableViewController(segue: UIStoryboardSegue) { 

    attachPhotoButtonFinish() 
} 

VC3 - 중간에 두 개의 버튼이 있습니다. 위의 두 세트는 모두 드래그하여 긴장을 풀고 StoryBoard를 사용하여 선택합니다.

내부 VC3은 VC2 어떤 사용자가 선택할 알고 있도록 SEGUE 준비 사용

override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    let destChatViewController = segue.destination as! ChatTableViewController 


    if segue.identifier == "library" // library Button 
    { 
     print("set cameraType to library from popupviewcontroller") 
     let time = getCurrentTime() 
     print("==== timer start ====== \(time.3):\(time.4):\(time.5)") 

     destChatViewController.cameraType = "library" 
    } 
    else if segue.identifier == "newphoto" // newphoto Button 
    { 
     print("set cameraType to newphoto from popupviewcontroller") 
     let time = getCurrentTime() 
     print("==== timer start ====== \(time.3):\(time.4):\(time.5)") 

     destChatViewController.cameraType = "newphoto" 
    } 

    // for unwind segue, no need to call dismiss 
    print("not calling dismiss pop up") 
    let time = getCurrentTime() 
    print("==== timer start ====== \(time.3):\(time.4):\(time.5)") 

    //dismiss(animated: true, completion: nil) 
} 

내부 VC2, attachPhotoButtonFinish는 사용자의 선택도

func attachPhotoButtonFinish() { 

    print("attachphotobutton start") 
    let time = getCurrentTime() 
    print("==== timer start ====== \(time.3):\(time.4):\(time.5)") 


    let image = UIImagePickerController() 
    image.delegate = self 

    if cameraType == "library"{ 
     image.sourceType = UIImagePickerControllerSourceType.photoLibrary 

    } 
    else if cameraType == "newphoto"{ 
     image.sourceType = UIImagePickerControllerSourceType.camera 
     image.cameraCaptureMode = .photo 
    } 
    else{ 
     print("Something wrong!!!") 
     return 
    } 
    image.allowsEditing = false 
    image.modalPresentationStyle = .overCurrentContext 

    print("calling imagepicker") 
    let time1 = getCurrentTime() 
    print("==== timer start ====== \(time1.3):\(time1.4):\(time1.5)") 

    self.present(image, animated: true, completion: nil) 
} 

그리고 I에 따라 이미지 피커 컨트롤러를 호출하려고합니다 VC3의 초기화 시간을 인쇄하려고 시도하십시오.

deinit{ 
    print("===== \(self.classForCoder.description()) be deinit") 
    let time = getCurrentTime() 
    print("==== timer start ====== \(time.3):\(time.4):\(time.5)") 

} 
실행 결과, 때로는 (1 중 1) VC3 현재 이미지 선택기 전에 VC3 완료. 그래서 나는 그것을 정확하게 볼 수 있습니다.

==== 타이머 시작 ====== 18시 34분 58초
팝업
==== 타이머 시작 ======을 기각 호출하지 18시 34분 58초

이 ==== 타이머 시작 ======이 18시 34분 58초

==== 타이머 시작 ======을 시작 attachphotobutton ChatTableViewController cameraType = 라이브러리에 휴식을 취 18시 34분 58초
imagepicker 전화
==== 타이머 시작 ====== 18:34:58
===== PhotoStreamSourceTest.PopupPhotoSourceVC는 초기화됩니다.
==== 타이머 시작 ====== 18:34:59
2017-09-20 18 : 34 : 59.274464 + 0800 PhotoStreamSourceTest [14690 : 399530] [AXRun-PID] PID의 일시 중단을 요청하는 클라이언트 : 14706 이름 :
2017-09-20 18 : 34 : 59.283271 + 0800 PhotoStreamSourceTest [14690 : 399463] [MC] systemgroup.com.apple.configurationprofiles 경로의 시스템 그룹 컨테이너는 다음과 같습니다. /Users/_/Library/Developer/CoreSimulator/Devices/54B3F249-2C6A-4C18-B2E1-C7271199A7CF/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-09-20 18 : 34 : 59.284012 +0800 PhotoStreamSourceTest [14690 : 399463] [MC] 개인 유효 사용자 설정 읽기.

그러나 대부분의 경우 다음과 같은 결과가 나타나며 이미지 선택 도구가 표시되지 않습니다.

==== 타이머 시작 ====== 18시 35분 48초
팝업
==== 타이머 시작 ======을 기각 호출하지 18시 35분 48초

이 ==== 타이머 시작 ======이 18시 35분 48초

==== 타이머 시작 ======을 시작 attachphotobutton ChatTableViewController cameraType = 라이브러리에 휴식을 취 18시 35분 48초
imagepicker 호출
==== 타이머 시작 ====== 18:35:48
2017-09-20 18 : 35 : 48.967515 + 0800 PhotoStreamSourceTest [14690 : 400836] PID의 일시 중단을 요청하는 클라이언트 : 14706 이름 :
2017-09-20 18 : 35 : 49.049357 + 0800 PhotoStreamSourceTest [ 14690 : 399463] 경고 : 발표가 진행되는 동안을 발표하려고 시도합니다!
===== PhotoStreamSourceTest.PopupPhotoSourceVC은
==== 타이머 시작 ====== 18시 35분 49초

deinit 수 주셔서 감사합니다!

+0

보기 [경고의 의미 "프레젠테이션 진행 중!"] (https://stackoverflow.com/a/17120065/4056108) – chirag90

+1

@ chirag90 빠른 답장을 보내 주셔서 감사합니다. 나는 긴장을 풀지 않는 segue가이 시나리오에 적합하지 않은지 궁금합니다. 이미지 피커를 호출하기 전에 VC3가 닫혀 있는지 확인하십시오. – Hungo

+0

죄송합니다. 메이트, 경고 만 돕고있었습니다. – chirag90

답변