Animate contentInset

ios, uiscrollview, uiviewanimation, uiwebview

Solution

Try something like this:

CGFloat height = 80.0f //change to whichever value you want

[UIView animateWithDuration:0.2 animations:^{
    [self.peopleCollectionView setContentInset:UIEdgeInsetsMake(height, 0, 0, 0)];
}];
[self.peopleCollectionView setContentOffset:CGPointMake(0, -height) animated:YES];

Problem

I'd like to animate the contentInset of a scrollView which belongs to a UIWebView. I tried the following code, but unfortunately the inset just jumps when it runs ``` UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState; [UIView animateWithDuration:10.0 delay:0 options:options animations:^ { self.webView.scrollView.contentInset = UIEdgeInsetsMake(100 ,120,120,120); } completion:nil]; ``` Does anyone know how i can make a smooth animation of contentInset? I also tried the option AllowAnimatedContent with no luck

Original source