我打开了一个登录模式 UIViewController 并且在 60 秒内以模态方式显示第二个“谢谢”Viewcontroller 然后关闭它,但我可以弄清楚如何在 SWIFT 中执行此操作。(在Objectiv C中很容易)
这是我在关闭第一个后打开“Thank you viewcontroller”的代码。
weak var pvc = self.presentingViewController
self.dismiss(animated: true, completion: {
let thankYouExistingVC = self.storyboard?.instantiateViewController(identifier: "ThankYouExistingVC") as! ThankYouExistingVC
pvc?.present(thankYouExistingVC, animated: true, completion: nil)
})
Run Code Online (Sandbox Code Playgroud)
您可以使用DisaptchQueue:
DispatchQueue.main.asyncAfter(deadline: .now() + 60) {
// Do whatever you want
theViewControllerToDismiss.dismiss(animated:true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
468 次 |
| 最近记录: |