是否有像 android 那样完成 UIviewcontroller 的函数?

Is there a function to finish a UIviewcontroller like in android?

在 android 中您可以调用方法 finish() 并且 activity 关闭。 swift中有类似的东西吗?

不完全是。在 iOS 土地上,如果您的视图控制器是模态的,或者如果您的 viewController 被推到屏幕上,则您必须更明确地调用 viewController.dismissViewControllerAnimated(true, completion: nil) 或 UINavigationController 上的各种解雇方法之一。

Swift3这个函数是:

viewController.dismiss(animated: true)

简单优雅的解决方案,写下一行以关闭当前的视图控制器

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