I have the following code:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 1)];
[webView loadHTMLString:[input objectForKey:@"htmlContent"] baseURL:nil];
CGSize size = [webView sizeThatFits:CGSizeMake(kWidth, FLT_MAX)];
webView.frame = CGRectMake(0, 0, kWidth, size.height);
NSLog(@"%@",NSStringFromCGRect(webView.frame));
NSLog(@"%@",NSStringFromCGSize(size));
The idea was taken from this answer and as OP mentions before using sizeThatFits
there is a minimum size chosen i.e. 1. The output of on the screen is as follows:
{{0, 0}, {768, 1}}
{768, 1}
In other words, the height doesn't get modified and what ever value I will pick instead of 1, it will remain as the height of my view. What exactly am i doing wrong?