Added whitespace in UIWebview - removing UIWebView whitespace in iOS7 & iOS8

前端 未结 6 2072
鱼传尺愫
鱼传尺愫 2020-12-13 18:43

Im loading local html files, since iOS7 there is added white space on top in the UIWebView.(I cant post an image as i do not have enough points.) image can be seen here- sna

6条回答
  •  温柔的废话
    2020-12-13 19:16

    I already got it .

    here my logic code, When the application open the website you must get the size of your webview then set it on height

    here my code

         ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) webpage.getLayoutParams();
                p.height = webpage.getHeight();
    // check if how long you need to set your height for webpage then set it :)
                Log.e(" webpage.getHeight()", String.valueOf(webpage.getHeight()));
                webpage.setLayoutParams(p);
    

    Hope you will take my code and my answer to :) works on any devices even tabs too :)

提交回复
热议问题