使用performSegue從UIView類我有一個UIView
類,它包含一個UILabel
。我加入了一個UILabel
和UITapGestureRecognizer
想做performSegue
對UILabel
的水龍頭打開一個新的UIViewController
。 的問題是,我不能在UIView
類使用performSegue
。如何迅速3
誰能請幫助UIView
類使用performSegue
?
我加了點觸手勢,以我的標籤爲,
nameLabel.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(tapFunction))
tap.numberOfTapsRequired = 1
tap.numberOfTouchesRequired = 1
tap.isEnabled = true
nameLabel.addGestureRecognizer(tap)
我tapFunction
現在,
func tapFunction(sender:UITapGestureRecognizer) {
print("tap working")
self.performSegue(withIdentifier: "memberSegue", sender: self)
}
但我得到一個錯誤:
"Value of type UIViewController has no member performSegue"
,因爲它是一個UIView類。
您可以顯示您當前正在嘗試的代碼。 –
請分享代碼UIView類 –