For the last couple of days I am trying to accomplish a fairly simple (at least it should be) layout using auto layout constraints, but without success.
My view
You might need a delay before updating webview content size. And masonry is useful for autolayout usage.
-(void)webViewDidFinishLoad:(UIWebView *)webview{
[self performSelector:@selector(checkContentOnDelay:) withObject:webview afterDelay:0.001];
}
-(void)checkContentOnDelay:(UIWebView *)webview{
CGSize contentSize = webview.scrollView.contentSize;
if (contentSize.height > 2) {
[webview updateConstraints:^(MASConstraintMaker *make) {
make.height.equalTo(contentSize.height);
}];
}else{
[self performSelector:@selector(checkContentOnDelay:) withObject:webview afterDelay:0.01];
}
}