我面臨有關的奇怪問題目前和關閉 ViewController。關閉視圖控制器意外的行爲
對於如: -
我在視圖控制器A然後我推到B
所以在導航控制器堆棧,我們有[A,B]
現在,如果我提出的任何視圖控制器B(像MFMailComposeViewController)
然後發送郵件或刪除草案中駁回MFMailComposeViewController並重定向到一個替代B.
後3210我對此進行了研究,但找不到任何替代方案。
我面臨有關的奇怪問題目前和關閉 ViewController。關閉視圖控制器意外的行爲
對於如: -
我在視圖控制器A然後我推到B
所以在導航控制器堆棧,我們有[A,B]
現在,如果我提出的任何視圖控制器B(像MFMailComposeViewController)
然後發送郵件或刪除草案中駁回MFMailComposeViewController並重定向到一個替代B.
後3210我對此進行了研究,但找不到任何替代方案。
如果您在ViewControllerB中的MFMailComposeViewControllerDelegate的didFinishWithResult方法中調用了Popviewcontroller方法,那麼它可能是可能的。而不是您在didFinishWithResult方法調用中避免PopViewController方法調用。
希望這會有所幫助。使用它,當你切換 - > B.
```讓分鏡= UIStoryboard(名稱: 「主」,捆綁:無)
desiredViewController = storyboard.instantiateViewController(withIdentifier: 「desiredViewController」)
UIApplication.shared.delegate?.window ??。rootViewController? = desiredViewController```
的B
self.navigationController?.present(MFMailComposeViewController, animated: true, completion: nil)
您可能已經使用
self.present(MFMailComposeViewController, animated: true, completion: nil)
希望這有助於
你好,你可以做這樣的嘗試這提出MFMailComposeViewController時,您在發送郵件或刪除草稿之後關閉MFMailComposeViewController,然後您可以檢查ViewController_Identifier是否'A_Screen',然後是av把它或逃脫它。否則,如果它是'B-Screen',則導航到該視圖控制器。
使用此邏輯根據需要進行導航。
let targetView: String! = self.restorationIdentifier
if targetView == "A_Screen"{
//Do nothing
}
else{
let B_View = self.storyboard?.instantiateViewController(withIdentifier: "B_Screen") as! BViewController
self.navigationController?.pushViewController(B_View, animated: true)
}
確保您已爲您的ViewControllers設置了identifierID。
希望它可以幫助你。
你可以顯示'MFMailComposeViewControllerDelegate'的didFinishWithResult方法嗎? –
分享代碼如何添加/刪除(推/流行/現在/關閉)NavigationController,A,B和MFMailComposeViewController。 –