Canceling the search doesn't work properly

Thread starter #1

gotcher

Closed Alpha Tester
The server searching window disappears after clicking the Cancel button, however it reappears at set intervals afterwards.
For obvious reasons, it is not yet possible to test whether the game continues to try to connect to any servers.
 
You need to implement the UISearchBarDelegate :

class ViewController: UIViewController, UISearchBarDelegate {
@IBOutlet weak var searchBar: UISearchBar!
Set the search bar delegate to self

override func viewDidLoad() {
super.viewDidLoad()

searchBar.showsCancelButton = true
searchBar.delegate = self
and then implement the butCancelSearchAction delegate function to do whatever you need to do to cancel the search action and reset the search text:

func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
// Do some search stuff
}

func searchBarCancelButtonClicked(searchBar: UISearchBar) {
// Stop doing the search stuff
// and clear the text in the search bar
searchBar.text = ""
// Hide the cancel button
searchBar.showsCancelButton = false
// You could also change the position, frame etc of the searchBar
}

Admin
Apps4Rent | O365CloudExperts | CloudDesktopOnline
 
Top