does anybody know how to make a search field in xcode (cocoa) talk to a webkit webview objetc to make it search google? can you show me the code/connections i need to make?
NSURL *searchURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/search?q=%@", [sender stringValue]]];
You'd probably do something like instantiate a custom object in your nib with an IBAction called -search:, and an IBOutlet for the webview, and then hook an NSSearchField to your search method. Then you can just do something along the lines of
to make a google search url.Code:NSURL *searchURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/search?q=%@", [sender stringValue]]];
dude, i recomend just LEARNING to code... if you just ask what code to copy/past every time you want to add or change in your app, you wont learn ANYTHING
i have spoken
dude, i recomend just LEARNING to code... if you just ask what code to copy/past every time you want to add or change in your app, you wont learn ANYTHING
i have spoken
[translation]If he was doing the research rather than copying and pasting code, it would help. Now, he's just learning to be dependent on others to provide him with everything.
I know it's tougher to do the research but when one doesn't have others available, what's a person to do? Hmm...
[translation]
"What if us other programmers didn't exist? How would you learn without us here babying you with it all? What I'm trying to tell you is that we would be more willing if you were to do some independent work on yourself, and if you come across a problem, then we would help"
[/translation]
You'd probably do something like instantiate a custom object in your nib with an IBAction called -search:, and an IBOutlet for the webview, and then hook an NSSearchField to your search method. Then you can just do something along the lines of
to make a google search url.Code:NSURL *searchURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/search?q=%@", [sender stringValue]]];
thanks for your advice. I will make macrumors the default homepage. I don't want to change the name, but i'll have something to make it a bit more macrumorishI think a way around the issues that people are having with tominated can be solved easily:
- turn it into a MacRumors "group project" of sorts, kind of small-scale open source
- change the name to Ruminated
- give credit where credit's due ... I like tominated's initiative, really I do, and I think that instead of arguing over his learning curve (I agree that with a book he'd learn better, but I also understand that learning practically by asking for help is useful, and f'r chrissakes, he's only 13 right? Let's cut him a little slack, by which, though, I don't mean "Give the boy a fish". How about giving him the occasional fish and guiding him in learning how to fish?), the Forum should come through and put together an awesome browser. One with awesome tab-support (a la OmniWeb?... A man can dream, and I'll settle for Shiira), a nice interface, and easy to use.
But that's just my opinion.
i have realised that the *searchURL is a variable
btw: it is saying that the variable is not used. i made a custom object with an action called search: and an outlet called searchURL, hooked it up to the search field and webview accordingly, created the header and main files, put the code you suggested in the search: action and it wont work. what have i done wrong?