Reputation: 192
i am building a Custom UIView with two UIWebViews with variable heights inside and some Labels.
I build the View with a xib File. In this Xib the View has a height of 500(but it can be greater depending on the content of the WebView)
Now i have the problem that i add two or more from my custom UIViews programmatically to my UIViewController inside a scrollview. But they are not among each other!
My custom views will be displayed right but don't have the right height constraint and so one is above each other and not below each other...
Upvotes: 0
Views: 1491
Reputation: 549
try this code snippet.
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *webHeight = [self.lblDetail stringByEvaluatingJavaScriptFromString:@"document.height"];
NSLog(@"height: %@", webHeight);
self.webViewHeightConstraint.constant = [webHeight intValue];
}
Upvotes: 2