I have had to change a UIScrollView
into a UIWebView
due to formatting reasons.
There is a problem though that I need to be able to get the content offset back to 0, 0
(as I am using reusable UIWebView
s and changing content) and get the content size so I can place a button at the bottom; but UIWebView
does not seem to have this.
This problem can be solved quite easily:
[[webView scrollView] setContentInset:UIEdgeInsetsMake(64, 0, 44, 0)];
Remember that UIEdgeInset is different from CGRect!
A guide on UIEdgeInset can be found in the iOS Developer Library.
The best way I found to sort the problem was:
UIWebView
UIScrollView
Using the "- (void)webViewDidFinishLoad:(UIWebView *)webView {" delegate method I detect the size of the UIWebView
Set the frame of the UIWebView
to the content size.
UIWebView
UIScrollView
to the content size.Then used the functionality of the UIScrollView
instead of the UIWebView
.
Thanks -JM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With