按下键盘上的回车键时,它将触发按钮动作。尽管这样做确实可行,但如果找不到任何内容,键盘将冻结,并且用户无法键入其他任何内容。我该怎么办?
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
londonButton.sendActions(for: .touchUpInside)
}
与londonButton关联的动作是
@IBAction func londonPressed(_ sender: Any) {
searchit()
}
func searchit() {
pulsePow()
city = search.text!.replacingOccurrences(of: " ", with: "+")