UIScrollView setContentOffset:animated not working in iOS11

You have to do

self.view.layoutIfNeeded()

before setContentOffset. It updates the contentSize of UIScrollView and then contentOffset is available.


(SWIFT 4) I had a similar problem, the problem was the animated : true. So, you can try by doing this manually:

view.layoutIfNeeded()
UIView.animate(withDuration: 0.2) {
   self.scroll.setContentOffset(.zero, animated: false)
}

Hope it helps. It fixed for me


try this

dispatch_async(dispatch_get_main_queue(), ^{
    [UIView animateWithDuration:.25 animations:^{
        [self setContentOffset:CGPointZero animated:YES];
    }];
});