I am customizing an open source QR Reader to take the text from a TextView and either do a Google search or open the text in a browser. The customer is adamant about using Google search only.
I have two buttons. “Google” and “Web”. The code indicates how they work.
I was thinking of appending “http//www.google.com/search='” with “resultText.text'”
But I don’t know the correct format on how to do that with a google search.
The code I have to do this thus far is:
- (IBAction)openBrowser :(id)sender
{
if ([[sender currentTitle] isEqualToString:@"Google"]) {
NSURL *url = [NSURL URLWithString:resultText.text];
[[UIApplication sharedApplication] openURL:url];
}
else if([[sender currentTitle] isEqualToString:@"Web"]){
NSURL *url = [NSURL URLWithString:resultText.text];
[[UIApplication sharedApplication] openURL:url];
}
}
I tried googling this, but as you can imagine the results were nothing close to what I was looking for. I kept getting Google/Apple search bar headlines from the recent news.
Cheers!
I found the answer to my own question after a more extensive search.
http://www.our-picks.com/archives/2007/01/30/google-search-urls-revealed-or-how-to-create-your-own-search-url/
Here is the code I added in:
}