You are setting the height contraint of your webView as 266. That’s why the height of the web view is still fixed.
You can create this height constraint as an IBOutlet, for example:
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *webViewHeightConstraint;
And then you can modify the constant of the height constraint when the web view has finished downloading the content. The web view itself consists of scroll view inside, so if you want to get the overall height of the content:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
self.webViewHeightConstraint.constant = self.webView.scrollView.contentSize.height;
}
Or apparently this one also works:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[self.webView sizeToFit];
self.webViewHeightConstraint.constant = self.webView.frame.size.height;
}