X xcoder78 macrumors newbie Original poster Jul 9, 2007 9 0 Jul 9, 2007 #1 Hi again, I was wondering if someone could tell me how to get a Google Search Bar in Xcode onto my Browser
Hi again, I was wondering if someone could tell me how to get a Google Search Bar in Xcode onto my Browser
robbieduncan Moderator emeritus Jul 24, 2002 25,611 893 Harrogate Jul 9, 2007 #2 You realise this is not a one-line of code thing. I suggest you start reading the documentation!
G grabberslasher macrumors 6502 Aug 2, 2002 409 1 Éire Jul 9, 2007 #3 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
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