UIScrollViews setContentOffset: behaves different than setContentOffset:animated:NO

Originator:markus
Number:rdar://16724593 Date Originated:25-Apr-2014 03:09 PM
Status:Open Resolved:
Product:iOS SDK Product Version:6.1 / 7.1
Classification:Other Bug Reproducible:Always
 
Summary:
UIScrollViews setContentOffset: behaves different than setContentOffset:animated:NO. You would expect, that it behaves the same when animated:NO is given. You would even expect, that one method calls the other one.

Actually setContentOffset: just changes the offset without canceling any running animation/deceleration. setContentOffset:animated: on the other hand actually stops any running animation, but ONLY when animated:NO is given.

Steps to Reproduce:
Build a UITableView with a lot of cells, e.g. 2000. Scroll, so the scrollView keeps scrolling after you lift your finger. Call setContentOffset: or setContentOffset:animated:NO during the time, when it still scrolls.

Expected Results:
You would expect on any manual change, that the animation will be stopped.

Actual Results:
The animation is ONLY stopped when calling setContentOffset:animated:NO, but NOT when using setContentOffset: or setContentOffset:animated:YES

Regression:
Tested in 6.1 and 7.1.1, probably the same in earlier versions

Notes:
Stackoverflow has some related questions, e.g. http://stackoverflow.com/questions/3410777/how-can-i-programmatically-force-stop-scrolling-in-a-uiscrollview/23290943

The behavior should at least be documented. That's not the case currently.

Comments

Apple asked for an example project

I provided this as an example: http://cl.ly/1H3x2p2h0f43


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!