I have a tabbed application, with a tab that contains a UIWebView and a second tab with a Table View Controller.
I'm trying to make it so that when I click on a row in the table it takes me to my other tab and loads a web page.
Here's my storyboard:

This is in my implementation for the web view:
-(void)loadAViewer:(NSURL*)viewerURL
{
NSURLRequest *requestObj = [NSURLRequest requestWithURL:viewerURL];
[sfnViewer loadRequest:requestObj];
}
And then in the table view controller:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Get the URL from plist
...
//Generate url, pass it in and switch to web view tab
viewerURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/viewer?username=%@&pw=%@&%@", web, loc, user, pass, params]];
ViewerFirstViewController *viewerWebView = [[ViewerFirstViewController alloc] init];
[viewerWebView loadAViewer:viewerURL];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self.tabBarController setSelectedIndex:0];
}
Currently nothing happens. I'm taken to the other tab but with a blank UIWebView - no page loads but it doesn't crash either.
//Edit - Changes made based on answer from Steve
Based on this I've added @property (strong, nonatomic) NSURL viewerUrl; in my .h file for the UIWebView tab.
I've synthesized it in the .m and added this to my viewDidLoad method.
NSURLRequest *requestObj = [NSURLRequest requestWithURL:viewerURL];
[sfnViewer loadRequest:requestObj];
In the Table View Controller I'm now doing this.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Get the URL from plist
...
//Generate url, pass it in and switch to web view tab
viewerURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/viewer?username=%@&pw=%@&%@", web, loc, user, pass, params]];
ViewerFirstViewController *viewerWebView = [[ViewerFirstViewController alloc] init];
[viewerWebView setViewerUrl:viewerURL];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self.tabBarController setSelectedIndex:0];
}
Still to no avail.