我的应用程序有一个 RSS tableView,在另一个页面上有一个 WebView。我可以通过单击 RSS 中的任何项目打开 WebView 但我无法传递链接并在 WebView 中显示网站下面是我的代码
(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]];
}
谢谢你的帮助!