swift - 在呈现给新 View Controller 之前关闭 View Controller

标签 swift uiview uiviewcontroller dismiss

我有三个 View Controller :1,2,3

我从 1 --> 2 移动,然后从 2 ---> 3 移动,现在我想从 3 ----> 1 等等。

当我位于 3 时,我需要关闭 View Controller 编号 2 因为如果我保留 View Controller 编号“2”,我似乎会出现内存泄漏。如果我多次重复此过程,可能会使应用程序变慢。

最佳答案

试试这个 - 在你的 View Controller 按钮操作中

self.dismiss(animated: true, completion: nil)

关于swift - 在呈现给新 View Controller 之前关闭 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51265467/

相关文章:

swift - 如何从另一个 ViewController 更改标签颜色? swift

ios - 使用展开转场从文本字段传递数据时出现问题

ios - 如何在满足 IF 后立即生成新的 View Controller ?

ios - 以编程方式使用堆栈 View

ios - 如何在 iOS Swift 中从 xib UIViewController 启动?

ios - RPScreenRecorder 如何录制应用Action Extension的屏幕音视频?

ios - Swift - 如何根据视频播放器帧的大小动态调整 UIView 的大小

ios - 在 UIView.animateWithDuration 之前完全取消隐藏 View

iphone SDK - 如何连接2个 Controller ?

ios - 如何编程延迟?