advertisement

Article:
  BYOB: Build Your Own Browser
Subject:   Code for google search:
Date:   2009-07-27 16:43:22
From:   macindev
In the header (.h) file:
(add between the { } brackets)
IBOutlet id searchQuery;


(add before the @end)
- (IBAction)connectSearch:(id)sender;


In the .m file:

- (void)connectSearch:(id)sender{
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:
[@"http://www.google.com/search?q=" stringByAppendingString:[searchQuery stringValue]]]]];
}


Then just hook up the outlets and actions in Interface Builder to the search bar, and voilą!

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Soz, i'm a noob
    2009-08-30 07:26:18  ProcEnforce [Reply | View]

    Where do you put code in the .m file?
  • Noob
    2009-08-30 07:26:03  ProcEnforce [Reply | View]

    Where do you put code in the .m file?
  • Code for google search:
    2009-08-30 07:25:58  ProcEnforce [Reply | View]

    Where do you put code in the .m file?