Why does the scroll indicator not appear when I decelerate a scroll view manually?
I had good reasons to disable the default deceleration behavior of UIScrollView to implement my own.
What I do is this:
1) When the user finishes dragging, I start an NSTimer to decelerate.
2) The timer calls periodically a method which scrolls the scrollview like this:
[self setContentOffset:CGPointMake(self.contentOffset.x, self.contentOffset.y + dy) animated:NO];
The scroll view decelerates nicely jus开发者_运维百科t the way how I want it.
But as soon as my timer kicks in to decelerate scrolling, the scroll indicator sticks with the contentView and slides up or down entirely, then disappears.
Calling -flashScrollIndicators
doesn't help to make them visible while manually animating the scroll.
Did that also happen to anyone else?
Are you running your timer on the main (GUI) thread? If so, it might be locking the gui till the timer expires. Try spinning off a new thread to run your timer and then implement a call back method using InvokeOnMainThread to update your scrollview to the desired location.
精彩评论