Search code examples
iosuiscrollviewuikitcore-animation

Background pattern jumping when animating UIScrollView.contentOffset manually


I'm attempting to animate the contentOffset of a UIScrollView by hand using the old-style [UIView beginAnimations:context:] method. I'm animating it instead of using setContentOffset:animated: because I want to control the duration. I'm using the old-style method rather than using blocks because I'm targeting iOS 3 and above (as an aside, is that a valid thing to do?).

When it animates, the subviews animate fine, but the background pattern jumps as if it wasn't being animated at all.

Does anyone know if there's anything special I have to do to get this work?

Thanks!

Edit: Current bodge is to have a vanilla UIView with its own background pattern within the scroll view. Far from ideal though :-(


Solution

  • What you need is autoScrolling / programmatically scrolling. Here it is http://www.aaron.griffith.name/weblog/2011/02/23/scrolling-a-uiscrollview-programmatically/