2011-12-04 18 views
0

に選択されたときのUIWebViewの作成:セルのいずれかをクリックするだけでセルが、私は次のコードを持っているのUITableView

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

    UIWebView *aWebView; 
    aWebView = [[UIWebView alloc] initWithFrame:CGRectMake(320, 0, 320, 480)];//init and create the UIWebView 
    aWebView.autoresizesSubviews = YES; 
    aWebView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); 
    //set the web view delegates for the web view to be itself 
    [aWebView setDelegate:self]; 
    //Set the URL to go to for your UIWebView 
    NSString *urlAddress = @"www.google.com"; 
    //Create a URL object. 
    NSURL *url = [NSURL URLWithString:urlAddress]; 
    //URL Requst Object 
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
    //load the URL into the web view. 
    [aWebView loadRequest:requestObj]; 
    //add the web view to the content view 
    [self.view addSubview:aWebView]; 

} 

をそれがのUIWebViewを作成し、後藤google.com必要がありますが、私は得る何らかの理由次のエラー:2011-12-04 23:47:56.825 AudStud[906:207] Unknown scheme, doing nothing: www.google.com

+1

URLを 'http:// www.google.com'に変更し、' loadRequest: 'を呼び出す前にUIWebViewをビューに追加してみてください。 – titaniumdecoy

+1

メモリリークがあり、addSubviewの後にaWebViewをリリースします。 – JOM

答えて

1

あなたのURLにはプロトコルの部分がありません。それはhttp://www.google.comでなければなりません。

関連する問題