iOS webView 网页位置下移/偏移

问题描述:

webview大小位置正确

webview加载的网页却下移

使得webview的底部露出

解决办法:

添加如下代码即可

  self.automaticallyAdjustsScrollViewInsets = NO     //oc
  self.automaticallyAdjustsScrollViewInsets = false  //swift

原因:

iOS7的时候在控制器(ViewController)类新增了automaticallyAdjustsScrollViewInsets属性默认是true   【 自动适配滚动视图(UIScrollView及子类)】

因为 automaticallyAdjustsScrollViewInsets 会根据所在界面的 status bar  navigationbar tabbar 等自动调整scrollview的inset ,所以改为false可以解决。

猜你喜欢

转载自blog.csdn.net/UFO00001/article/details/77870082
今日推荐