I am making a custom keyboard that has a search bar. In order for a user to be able to interact with it, they must be able to:
1- Input text with individual letter buttons.
2- Tap the search button.
As for number 1, I have working IBActions that are called at every button press. For example, here's the action for the letter "m":
@IBAction func mPressed(button: UIButton) {
searchBar.text! += "m"
}
However, the search button IBAction will not call:
@IBAction func searchPressed(button: UIButton) {
print("searchPressed")
}
When I connect the search button in storyboard to the "mPressed" action, that action is called. But when I reconnect it back to the "searchPressed" function above, it doesn't work again.
I have also made sure that I correctly connected the button to the action.
The search action is connected to the search button
The 'm' action is connected to the 'm' button
Thanks!
答案 0 :(得分:0)
In your screenshot search button connected to method searchButtonPressed
, but in code you have method searchPressed
.
Delete connection to searchButtonPressed
and reconnect to searchPressed
and it will work.