-1

こんにちは、テキストフィールドへのユーザーの入力をGoogleで検索できるようにしようとしています。現在持っているコードは次のとおりです。

-(IBAction)searchInfo: (id)sender {
NSString *query = [textField.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/%@", query]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];;
[textField resignFirstResponder];

テキストフィールドを(IBAction)ボタンにリンクしました。ユーザーが検索フィールドに入力したものをすべて作成して、Googleで検索され、Webビューに表示されるようにしています。

4

1 に答える 1