Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xcoder78

macrumors newbie
Original poster
Jul 9, 2007
9
0
Hi again, I was wondering if someone could tell me how to get a Google Search Bar in Xcode onto my Browser
 

grabberslasher

macrumors 6502
Aug 2, 2002
409
1
Éire
Assuming your search field is an outlet in the nib file and is called "mySearchBar"

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

Then you just load that URL in your web view.

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

This is a simple example, you can probably work from here :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.