UIWebview scrollview changes contentsize for no reason

北战南征 提交于 2019-12-22 08:34:09

问题


I have a uiviewcontroller which loads a uiwebview. When the uiviewcontroller loads the uiwebview everything is done correctly. But when one navigates away and returns back and the uiwebview is not loaded, it is displayed differently. The uiwebview scrollview's contentsize height changes by 64px, it gets higher.

When it is loaded for the first it looks like this

When one returns back to the view, this is what happens

I hope I was able to make my problem understandable. If more details are necessary, I am able to give more. Thank you


回答1:


I had a similar problem, try this code in your viewDidLoad method.

if([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)])
    self.automaticallyAdjustsScrollViewInsets = NO;



回答2:


You can do like this.
- (void) viewDidLoad { [super viewDidLoad]; self.automaticallyAdjustsScrollViewInsets = NO; }



来源:https://stackoverflow.com/questions/19155370/uiwebview-scrollview-changes-contentsize-for-no-reason

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