I use the following code:
UIView.animateWithDuration(30, delay: 0, options: UIViewAnimationOptions.CurveLinear, animations: {
self.textView.contentOffset = CGPointMake(0, 700)
}, completion: nil)
If the contentOffset is up to about 100, the animation works correctly and all text is visible. Everything higher than that leads to the disappearance of text at the beginning of the textlabel during the animation. The higher the contentOffset, the more text disappears during the animation. So I see white space for a while and then the remaining text comes into animation. Also: Once the animation is done, all text is visible again when I scroll up.
I have tried multiple UITextviews in various superviews. The general idea is a kind of Credits like animation where all text moves slowly upwards for about 30 seconds.
You can try looping small animations together like the following.
This still appears to be an issue even in iOS 10 SDK.
To work around it, I manually animated the scrolling using
setContentOffset:
, delaying each step usingperformSelector: withObject: afterDelay:
and implementing a method that scrolls one increment at a time (in my case 1/2 point).To prevent users from manually overriding the scroll animation, you have to manually disable user interaction (
animateWithDuration:
automatically disables user scrolling while the animation is playing), you also must have scrolling enabled. I also disabled selection and editing, because that fit my use:note: Objective-C code follows
And then implemented a method to be used as a selector to scroll one increment at a time