我試圖解僱一個VC並提出一個新的VC。但我不希望舊的VC再存在。我使用下面的代碼來解散當前的VC並呈現新的。但這樣,解僱與現在之間有一段時間間隔。我不希望用戶注意到這一點。所以,我想先介紹一下新的VC,然後解散前一個。有沒有辦法做到這一點?解僱目前的視圖控制器後提出新的視圖控制器 - swift
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let destinationController = self.storyboard?.instantiateViewController(withIdentifier: "login") as! Login
let presentingVC = self.presentingViewController
self.dismiss(animated: false, completion: {() -> Void in
presentingVC!.present(destinationController, animated: true, completion: nil)
})
爲什麼不按順序,先出現然後解僱(而不是現在的完成處理程序)呢?所以: 'presentVC!.present(destinationController,animated:true,completion:nil); self.dismiss(animated:false,completion:nil)' –
朋友你爲什麼要從堆棧中解散currentVc? –
直接可以通過使動畫爲假來解僱您。 –