Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

iPhone Programming - Making a Google Search bar

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
4,157
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 8, 2011

Antoher tutorial in my UIWebview Playlist. In this tutorial you will learn how to make a search bar search Google rather than load a website. It can be really usefull.

Main Code Used:
-(IBAction)Googlesearch:(id)sender {
NSString *query = [googleBar.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.co.uk/search?q=%@", query]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}

Previous Video: http://www.youtube.com/watch?v=wOLowFNYM70
First Video: http://www.youtube.com/watch?v=Cfq1t1ZU_fA

Intro: http://www.videocopilot.net/tutorials/

Link: http://developer.apple.com/devcenter/ios/index.action
Website: http://failcake.webs.com/
Twitter: http://twitter.com/failcakeapps
Channel: http://youtube.com/milmersxcode

  • likes, 2 dislikes

Link to this comment:

Share to:

Uploader Comments (MilmersXcode)

  • hmm one question how come youtube search does not seem to work al other search engines seem to work? where could i find the link string to place in the action to seach all youtube videos? ANy help will be greatly appreciated. thanks

  • @DevelopMentalAppZ For YouTube I found this:

    youtube . com/results?search_query=YOURS­TRINGHERE

    Hope that helps :D.

  • It doesnt work like there is nothing wrong with the code but the search doesnt load up in my browser

  • @xcoder4you This is only for iOS applications. It won't work if your trying it on the computer. Unless that's not what you meant?

    Have you connected the webView connections.

  • I used your code and it works like charm. Thank you for the great tutorial series. One question I have is how to operate the auto rotation properly. I tried to change the rotation but the top bar does not show on horizontal view. Any idea how to write the code that when auto rotation is enabled the search bar and goole bar would appear as well? By the way I am new to programing with Xcode and appreciate being schooled.:)

    Thanks a million for your help

    P.s you can use my E Mail Adrian_Philli

  • @MrAmp76 You might be surprised to know that there is no code needed. It's because of the way your interface is anchored. In IB select your top bar and go to the size attributes tab. There you will see a little box with red lines. Simply make all the lines red by clicking them. This will make your tab bar stay in the same place relative to everything else when the screen rotates.

    Hope this helps and if it doesn't feel free to ask for more help :D

see all

All Comments (14)

Sign In or Sign Up now to post a comment!
  • Your a nob why are you under how too put google on a iPhone don't make videos if you don't know the correct title for them.

  • @MrGoldminer97 Thanks :D

  • @MrYoranimo1 I used VideoCopilots tutorials. He makes loads of Adobe After Effects tutorials. Link in the description. If you scroll down a bit you will find all the tutorials.

    Hope this helps :D

  • how do you make that intro?

    i like it!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more