【发布时间】:2016-04-08 09:11:18
【问题描述】:
我也在尝试使用 UITapGesture 将 UIImage 设为按钮。
let contactSegueIdentifier = "showContactSegue"
override func viewDidLoad() {
initTapGestureRec()
}
func initTapGestureRec() {
let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: Selector("recognizeTapGesture:"))
brandMenuContactImage.addGestureRecognizer(tapGesture)
}
func recognizeTapGesture(sender: UIGestureRecognizer) {
self.performSegueWithIdentifier(contactSegueIdentifier, sender: self)
}
当我运行并点击图像时,什么也没发生。谁能帮帮我。
【问题讨论】:
-
尝试在 UIImageView 上启用用户交互...在 Storyboard 或
userInteractionEnabled = true -
哦,是的,它成功了。但是如何准备Segue? @Byron Coetsee
-
别忘了调用 super.viewDidLoad()
标签: ios objective-c iphone xcode swift