2012-05-11 23 views
0

My appにはRSS tableViewがあり、別のページにはWebViewがあります。私はRSSで任意の項目をクリックするだけでWebViewのを開くことができますが、私は、リンクを通過することができず、WebViewの下の でウェブサイトを表示する私のコードは、任意のヘルプWebView(iOS)で開くRSSリンク

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

    int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; 

    NSString * storyLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"]; 


    // clean up the link - get rid of spaces, returns, and tabs... 
    storyLink = [storyLink stringByReplacingOccurrencesOfString:@" " withString:@""]; 
    storyLink = [storyLink stringByReplacingOccurrencesOfString:@"\n" withString:@""]; 
    storyLink = [storyLink stringByReplacingOccurrencesOfString:@" " withString:@""]; 


    [tableView deselectRowAtIndexPath:indexPath animated:NO]; 

    browserScreen = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:nil]; 
    [self.view addSubview:browserScreen.view]; 


    // open in Safari --> this line works perfect but I want to open the link in my own Webview so I commented it out 
    //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:storyLink]]; 

} 

感謝です!

答えて

0

DetailsViewControllerにUIWebViewがあると仮定すると、DetailsViewControllerにあるWebViewにURLを設定する必要があります。

browserScreen.webView.request = [NSURLRequest requestWithURL:[NSURL URLWithString:storyLink]]; 
+0

ありがとうございましたが、うまくいきませんでした。私の問題は、ストリングリンクをグローバルストリングとして使用することです。 webViewには、DetailsViewControllerのstoryLinkが表示されません – user1279453

+0

別のソリューションが見つかりました.WebViewに「storyLink」を渡すためにglobel文字列を使用する必要がありました。それでも、時間をとってくれてありがとう – user1279453

関連する問題