UIWebview resize height to fit content

烈酒焚心 提交于 2019-12-05 04:59:10

Anyone got an idea as to why the Webview appears fine just long enough for me to notice and then "shrink" back?

I would say that it appears fine because you are showing the changes as they are happening. Why not hide the web view at some earlier point in the view lifecycle or even in webViewDidFinishLoading? I am sharing my layout settings from IB in case that may provide further assistance. Please advise if this helps or whether additional information is needed. I am using springs and struts rather than auto layout. I would try these method to see if it works for you.

Hiding my web view data loads prevents users from seeing anything until all of my settings/data are in place.

    NSString *path = [[NSBundle mainBundle] bundlePath];
    NSURL *baseURL = [NSURL fileURLWithPath:path];

    [webView setAlpha:0];
    [webView loadData:[dataString dataUsingEncoding:NSUTF8StringEncoding] MIMEType:@"text/html" textEncodingName:@"UTF-8"  baseURL:baseURL];

    [UIView animateWithDuration:0.1 animations:^{

        [webView setAlpha:1.0];

    } completion:nil];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!