替换 viewcontroller 而不让它出现在它后面

Replace the viewcontroller without it appearing behind it

我的问题发生在更改 VC 时,旧的 VC 继续出现在后台(请参阅 screen capture)。我该如何解决?

感谢您的帮助。

sheet 演示文稿样式显示为 card。要让它全屏使用这个。

let vc = UIViewController()
vc.modalPresentationStyle = .fullScreen //or .overFullScreen for transparency
self.present(vc, animated: true, completion: nil)

如果VC要消失,尝试去掉它的引用-调用析构函数-deinit,然后VC会被ARC

销毁

有帮助link: Swift deinitialization and ARC