NothingFoundCell is not awaken from .xib - when "if searchBar.text! != “Justin bieber” is executed, i.e. I put “Justin bieber” into the bar field, the code in SearchViewController does not reach tableView dequeueing part of “if searchResults.count == 0, awake nothingFoundCell”. Tried all I could, seems to me: FileMerge shows the code is identical to the original tutorial, breakpoint is not reached.
searchBar text is capitalized by default in XCode7.2.1 Simulator, this is why I put the string beginning with a capital letter.
As for normal search - everything works, so the second part of tableView(cellForRowAtIndexPath) method is called properly.
What could be the reason of such an enigmatic behaviour? searchResults.count somehow is >0 ?
Thanks for any idea!
If the code checks for the text
"justin bieber" and you search for
"Justin bieber" then this is not recognized as the same thing. The text has to match exactly. (You can change the text field so that it does not automatically capitalize things in the Attributes inspector.)
Capitalizing was not a problem. I mentioned it just by the way. For some reason “Capitalization = None” was not working by the Storyboard, I’ve just put “searchBar.autocapitalizationType = .None” into viewDidLoad manually.
Anyway, now “justin bieber” appears in a searchBar as it was meant in the tutorial, but it does not affect the problem of the “nothingFoundCell”.
Got some idea what might be the reason?
Somehow the “nothingFoundCell” is awaken after a search by URL was implemented in func searchBarSearchButtonClicked method.
So, there was a logical mistake obviously which I hadn’t spotted.