Swift Storyboard Cross解散过渡闪烁不同的视图控制器
我正在创建一个具有交叉溶解过渡的应用程序。当呈现视图控制器时,就会发生问题,并且每次交叉解散过渡发生直到应用程序被迫关闭并重新启动时,先前的屏幕闪烁一秒钟。许多视图控制器使用以下列出的代码以4种不同的方式显示。通过使用故事板的“显示”或“显示细节”链接到另一个视图控制器的按钮从一个视图控制器链接到另一个视图控制器,这些按钮不包含在下面的代码中。感谢提前的任何帮助!
代码:
方法1
DispatchQueue.main.async {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
self.present(vc, animated: true, completion: nil)
}
方法2
DispatchQueue.main.async { self.navigationController?.popViewController(animated: true)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let alert = storyboard.instantiateViewController(withIdentifier: "Alerts")
alert.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
alert.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
self.present(alert, animated: true, completion: nil)
}
I am creating an app with cross dissolve transitions. The issue occurs when a view controller is presented and a previous screen flashes for a split second every time a cross dissolve transition happens until the app is forced closed and restarted. A lot of the view controllers are displayed in 4 different ways using the code listed below. Some are changed using a button from one view controller linked to another view controller with using storyboard's "show" or "show detail" which is not included in the code below. Thanks for any help in advance!
Code:
METHOD 1
DispatchQueue.main.async {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
self.present(vc, animated: true, completion: nil)
}
METHOD 2
DispatchQueue.main.async { self.navigationController?.popViewController(animated: true)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let alert = storyboard.instantiateViewController(withIdentifier: "Alerts")
alert.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
alert.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
self.present(alert, animated: true, completion: nil)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论