2017-09-30 16 views
0

세 개의 ViewController가 있습니다. Ok 경고 단추를 클릭하면 ThirdViewController에서 SecondViewController으로 segue를 수행하고 싶습니다. 나는 이미이 코드를 시도 :Xcode Swift는 경고가있는 세그먼트를 수행합니다.

alert.addAction(UIAlertAction(title: "Ok!", style: UIAlertActionStyle.default, handler: { action -> Void in 
    self.performSegue(withIdentifier: "ThirdViewControllerSegueBack", sender: self) 
})) 

문제는 SecondViewController의 새 창이 표시되는지, 그래서 내가 탐색 모음에서 back를 클릭 할 때 다시 ThirdViewController로 날 리드. FirstViewController을 표시하고 싶습니다. 당신이 긴장을 풀고를 작성해야합니다 SecondViewController에서

+2

푸시 풀이 필요합니다. https://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use - – Shades

+0

시나리오에서 작동하는 경우이 방법을 사용해보십시오. https://stackoverflow.com/questions/45792130/unwind-then-segue-without-showing-intermediate-view-controller/45792543#45792543 – Amit

+0

방법 : (긴장을 푸십시오) https://medium.com/@mimicatcodes/create-unwind-segues-in-swift-3-8793f7d23c6f – AlexWoe89

답변

0

버튼을 종료하고 SEGUE를 추가 할 수의 ViewController에서 ViewController3 드래그에서 스토리 보드에

@IBAction func unwindToController2(segue:UIStoryboardSegue) { } 

을 SEGUE. 식별자를 추가하고 UIAlertController를 호출하십시오. enter image description here

+0

고맙습니다. –

+0

@ lolinger2001) 환영합니다. 정확한 답변을 확인하십시오) – maxkoriakin