我有一个 UIViewController,它包含一个容器,其中嵌入了另一个 UIViewController。我想在用户点击容器时显示第三个 UIViewController。
到目前为止,我设法做到了这一点:
@IBOutlet weak var requestDetails: UIView! //my embedded container
override func viewDidLoad() {
let gesture = UITapGestureRecognizer(target: self, action: "showRequest:")
requestDetails.addGestureRecognizer(gesture)
}
func showRequest(sender:UITapGestureRecognizer){
print("hi")
}
现在,当用户点击容器时,我可以将 hi
打印到控制台。但我想在全屏上显示另一个名为 fullscreenViewController
的 UIViewController。我该怎么做?
最佳答案
这是快速版本:
presentViewController(fullScreenViewController, animated: true, completion: nil)
当然你可以从 Storyboard 中做到这一点:
例如,您只需按住 CTRL 并单击一个按钮,然后拖动到您要显示的 View Controller ,然后单击 show
希望对你有帮助
关于ios - 当用户快速点击我的容器时,如何打开另一个 UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35918341/