问题
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