[英]Is there a function to finish a UIviewcontroller like in android?
在android中,您可以调用方法finish()
并关闭活动。 swift中有类似的东西吗?
不完全的。 在iOS中你必须更明确地调用viewController.dismissViewControllerAnimated(true, completion: nil)
如果你的viewController被推到屏幕上你的视图控制器是UINavigationController上的模态或各种解雇方法之一。
在Swift 3中,这个功能是:
viewController.dismiss(animated: true)
简单优雅的解决方案,写下以下行以关闭您当前的视图控制器
self.dismiss(animated: true, completion: nil)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.