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 *'
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];
}
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];
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];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.