View Full Version : Xcode: Google searchbar in Browser?

Jul 9, 2007, 03:43 PM
Hi again, I was wondering if someone could tell me how to get a Google Search Bar in Xcode onto my Browser

Jul 9, 2007, 03:53 PM
You realise this is not a one-line of code thing. I suggest you start reading the documentation!

Jul 9, 2007, 04:07 PM
Assuming your search field is an outlet in the nib file and is called "mySearchBar"

NSString *searchURL = [NSString stringWithFormat:@"http://www.google.com/search?q=%@", [mySearchBar stringValue]];

Then you just load that URL in your web view.

[[myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: searchURL]]];

This is a simple example, you can probably work from here :)