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

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -