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
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];
UIView.animate({
self.tableView.contentInset = .init(top: tableViewOffset, left: 0, bottom: 0, right: 0)
self.tableView.setContentOffset(.init(x: 0, y: -tableViewOffset), animated: false)
}, onComplete: { Swift.print("Anim completed") })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With