I'm almost done with resizing my UIWebView. I used the delegate method :
In .h :
@interface myController : UIViewController <UIWebViewDelegate>
In .m :
#pragma mark UIWebView delegate methods
- (void) webViewDidFinishLoad : (UIWebView *) aWebView
{
CGRect frame = aWebView.frame;
frame.size.height = 1;
aWebView.frame = frame;
CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
frame.size = fittingSize;
aWebView.frame = frame;
}
But what I need is a webview with fixed-width and variable-height depending on the content.
The previous code is almost fine but the webview is also extended and scrollable horizontally.
I also tried this :
[myWebView setUserInteractionEnabled:NO];
But it only disables the scroll, not adapts the content.
How to fix this please ?
Best Answer
This might help. I got it working quite easily:
https://stackoverflow.com/a/6104537/1413088