My application has two views and I want to invoke a google search on Second view with a search string (it is name of a product. For example ‘Samsung Mobile’) passed from application’s Main view.
I dont want to enter product name in Google search field manually. It should be done automatically when I press the button on the Main View and the result page should be displayed on Sub View.
-(void) setLabelText:(NSString *) myNewText
{
[productName setText:myNewText];
NSURL *theURL =[NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *theRequest = [NSURLRequest requestWithURL:theURL];
[webSearchView loadRequest:theRequest];
}
Just wondering is it possible to pass the search string as a parameter with the above function.
Try this:
Don’t forget to escape
urlStringbefore passing it to NSURL if it contains spaces, special characters, etc.