嘿,这是我在 rootviewcontroller.m 上的代码(RSS 页面)
NSDictionary* 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:@""];
NSLog(@"link: %@", storyLink);
browserScreen=[[BrowserViewController alloc] initWithNibName:@"BrowserViewController" bundle:nil];
browserScreen.storyLink =[[stories objectAtIndex: storyIndex] objectForKey: @"link"];
[self.view addSubview:browserScreen.view];
这会打开 WebView 页面,但不会加载我请求的 url。这是我的 BrowserViewController.ms viewDidload 页面(网络视图,我还在 .xib 文件中修补了东西)
- (void)viewDidLoad
{
[super viewDidLoad];
// NSString *urlAddress = storyLink;
NSString *urlAddress = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"storyLink"];
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
// Do any additional setup after loading the view from its nib.
}
希望有人帮助,因为我对此感到绝望