How to dynamically increase the height of UIWebView? - ipad

How to dynamically increase the height of UIWebView based on the content inside it??

Related

WKWebView dynamic height calculation based on font size

I'm trying to calculate WKWebView content height according to font size. There is a lot of topic about it but none of it worked for me. I created demo app for test. In my test app I'm changing size of font via slider and I tried to calculate size of cell but I didn't get correct content size of webView.
Simply app work like that
Text downloaded from web.
Splitted to html array for add a different cell between webviews
cell.
When split html I add some tag for javascript injection(like
font size and font color)
Slider inject new font size to webviews and after that calculate
webView height again.
https://github.com/gelasdev/gelasdev-wkWebviewResize

How to increase UICollectionView height dynamically as it's content size increases?

I have a UICollectionView and inside that UICollectionView there are three cells and one header.
The header is for image.
And the three cells are for Social likes,About and Gallery.
Here is the view
Inside that Gallery cell there is a UICollectionView .
I want that UICollectionView (Inside Gallery Cell) increases it's height as it's content increases so that the Gallery Cell increases it's height then the whole the View i.e the parent UICollectionView will increase it's height and the whole page will scroll.
I can't increase the height of the UICollectionView inside the Gallery Cell dynamically as it's content increases so that the Gallery Cell will increase it's height dynamically and the whole page will increase it's height dynamically.
Take a constraint of the collection view height and set it to collection view content size.

Creating different cell sizes with dynamic height and full height

I understand how to create custom UITableViewCells with a dynamic height in iOS8+.
Within our app we have some full size height cells, for error/loading states. Then we have some dynamic height cells for the actual correct content.
What is the correct way to handle a full height cell using the dynamic height approach? Previously we would use the heightForRowAtIndex and set the height to the be the tableView.frame.size.height for example.
Now we need to have some cells which would be fullsize, some which might be 200 and some which might be 240 as an example.
Just setup the constraints in your full size cells to calculate to the correct height. You can either give them a constant height constraint or base it on it's content.
That way you don't have to mix absolute and dynamic heights.

Can't change UITableView height dynamically

Another problem - can't change UITableView height dynamically. If I change it in xib, it doesn't reduce when it is needed. Stupid problem, but can't resolve it for a whole day.
So, when contentSize is less than initial tableView height, it must reduce tableView height. If contentSize is more than initial tableView height, it must increase tableView height.
My code is here: https://github.com/serg1991/diplom_newbase/blob/master/diplom/BiletChildViewController.m

How to adjust the height of a tableView Cell based on html content of the web-view inside it?

I have seen the solutions where we find the height of a webview based on content but that happens after the webview has been loaded.
my webview is inside a TableView Cell, Its height depends on what height I give to tableView whose height should depend on content.
I have a maximum limit for height but if the content takes lesser space I would like to reduce it a bit.
Now How do I gracefully do it, as Cell's height is controlled by tableView delegates.
shall I send a delegate message from cell to reload the tableView or cell with new height ?
Create the webviews and load the contents first, make sure the height of the webview is zero
After all the webview was loaded, set the TableView's Delegate and DataSource, modify the height of all the webviews.
Override -(CGFloat)height...tableview indexPath.... As below
{ return eachWebviewInside.scrollview.contentSize.height;}

Resources