Reputation: 251
I have a UIWebView
in UITableView
, I have this on storyboard:
The UIImageView
is my future NavBar and the UIWebView
is in the UITableView
, I have this configuration:
UIImageView
UITableView
UIWebView
UITableViewCell
When the UIWebView
load the pages (I have local pages) I want that it takes dynamically their size and for this I have this code:
[detailWebView setFrame:CGRectMake(0.,0.,detailWebView.frame.size.width,[[detailWebView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] intValue])];
The problem is when the loaded page is long, my UIWebBrowser
hide the cells and didn't push them to get cells at the bottom.
I don't understand why I have this, when I resize the UIWebBrowser
in the storyboard I don't have this problem but I want to do it programmatically
Thanks,
Upvotes: 1
Views: 417
Reputation: 251
Thanks to tkanzakic, I solved the problem by adding an empty cell at the beginning, and changing their heigh
heigh of the 1st cell = old webView.heigh - actual webView.heigh
To change the heigh of cell I used tableview:cellForRowAtIndexPath
And no need to reload all data of the tableView I just use this:
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:0 inSection:0];
NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];
[detailsTableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
Upvotes: 1