swift - One SearchBar for loading URL and searching -
i'm searching how can when searchbar see it's url , go url instead of searching on google. example, when write www.twitter.com
in searchbar, webview load twitter instead of searching, search still available same searchbar.
my code :
func searchbarsearchbuttonclicked(searchbar: uisearchbar!) { searchbar.resignfirstresponder() var text = searchbar.text text = text.stringbyreplacingoccurrencesofstring(" ", withstring: "+"); var url = nsurl(string: "http://google.com/search?q=".stringbyappendingstring(text)); var req = nsurlrequest(url:url!) self.webview!.loadrequest(req)
Comments
Post a Comment