我尝试在tapBlarButton(_ sender: UITapGestureRecognizer)
函数中调用函数viewWillAppear
,但我不知道该怎么做,这是我的代码:
@IBOutlet weak var buttonFunction: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapBlarButton(_:)))
buttonFunction.addGestureRecognizer(tapGesture)
}
func tapBlarButton(_ sender: UITapGestureRecognizer) {
print("Hello! ")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Here I want to call the function
}