Reputation: 4302
I am trying to call a UIView inside of a UITableViewController.
JHWebViewController has been created in the storybaord.
JHWebViewController *myWebView = [[JHWebViewController alloc] init];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
myWebView.request = requestObj;
[self presentViewController:myWebView animated:YES completion:nil];
The error I get is Property 'request' not found on object of type 'JHWebViewController *'
Upvotes: 0
Views: 56
Reputation: 1916
Maybe try to embed the web view in a modal view controller and present the controller modally. Declare a public NSURLRequest property and set it from the table view delegate method.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath`
{
YourEmbeddingViewController *evc = [[YourEmbeddingViewController alloc] init]; // subclass of UIViewController
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
evc.request = requestObj;
[self presentViewController:evc animated:YES completion:nil];
}
Upvotes: 0
Reputation: 787
You can write the relevant code in UITableView didSelectRowAtIndexPath method I hope it will work for you
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath`
{
[self.view addSubview:myWebView.view];
}
Upvotes: 1
Reputation: 11519
You try try this:
JHWebViewController *myWebView = [[JHWebViewController alloc] init];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:requestObj];
myWebView.scalesPageToFit = YES;
[self.view addSubview:myWebView.view];
Upvotes: 0