如何从 UIView 内部正确准备 segue NOT UIViewController
我的 UIViewController 有一个容器 View ,并且在该容器 View 中有一个按钮。
class myInnerView: UIView {
...
func myButton(gesture: UIGestureRecognizer){
//calling a perform segue from another UIViewController does not recognize the SegueID
//ViewController().self.showProfile(self.id) -- DOES NOT WORK
}
}
class ViewController: UIViewController {
...
func showProfile(id: String){
...
self.performSegueWithIdentifier("toViewProfile", sender: self)
}
}
最佳答案
您的 View 不应处理按钮点击。这应该由 Controller 处理。 (这就是为什么它被称为“ Controller ”,而 UIView
被称为“ View ”的原因)。
关于ios - 如何从 UIView 内部执行 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31080464/