I have to add UIWebView and some buttons and labels inside UIScrollView. I have seen many question on how to add UIWebView inside UIScrollView but unfortunately they were unable to help me complete my task. So kindly don't mark it as duplicate or something.
Theoretically, the problem can be solved by following steps:
1) Make UIWebView a subview of UIScrollView.
2) Call setScrollEnabled:NO for UIWebView to disable its native scrolling.
3) Set the content size of both UIScrollView and UIWebView to the size of the HTML string loaded inside UIWebview.
I am using iOS 6 and StoryBoards. I have added UIWebView as the subview of UIScrollView.
Then in my webViewDidFinishLoad, I have used the following:
NSString *webHeight = [webView stringByEvaluatingJavaScriptFromString:@"document.height;"];
NSLog(@"WebView Height %@", webHeight);
That gives me the height of the WebView.
On the StackOverFlow, I have come across the following.
CGRect frame = webView.frame;
frame.size.height = 1;
webView.frame = frame;
CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
frame.size = fittingSize;
webView.frame = frame;
NSLog(@"size: %f, %f", fittingSize.width, fittingSize.height);
Then i have set the size of the UISCrollView to the size UIWebView:
mainScrollView.contentSize = webView.bounds.size;
I can scroll down to the bottom but there is a white space at the bottom and UIWebView is not making its size according to the size of the loaded html content.

Looks like UIScrollView has changed it size to the size of the content of UIWebView but UIWebView is not showing all of it. How can I solve this issue?
Kindly do not advice me about the Apple documentation that says you should not use UIWebView inside UIScrollView. I already know that but I want to use it as per my project requirement.