1
所以我做了一个文本字段,在那里我可以搜索网页或谷歌。问题是,我无法在google上搜索多个单词:例如,我可以搜索Stackoverflow,但无法搜索Stackoverflow问题。这里的代码:在谷歌搜索
{
if ([textField.text hasPrefix:@"http"]){
url=[NSURL URLWithString:[textField text]];
request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}else{
stringOne = @"http://www.google.com/search?q=";
NSString *stringTwo = TextField.text;
NSString *googleSearchString =[stringOne stringByAppendingString:stringTwo];
NSURL *google = [NSURL URLWithString:googleSearchString ];
request = [NSURLRequest requestWithURL:google ];
[webView loadRequest:request];
}
}
谢谢你的帮助!
它的工作原理!非常感谢!我正在为这个问题寻找解决方案,我花了太多时间搜索它!再次感谢你! – Adri 2012-02-20 19:14:42