iPhone UIScrollView - How to animate scrolling with steady contents?
Posted
by timbos
on Stack Overflow
See other posts from Stack Overflow
or by timbos
Published on 2010-03-30T01:43:48Z
Indexed on
2010/03/30
1:53 UTC
Read the original article
Hit count: 567
Hi all, I'm wondering if anyone knows how to prevent the contents of a uiscrollview from moving unsteadily when scrolling manually by setting the content offset. When scrolling by touch the text remains clear and steady. I would like to recreate this by animating with the animated option set to false. I'm using a timer to scroll at a given interval. The text is being drawn to a view in the contents, but it vibrates and it becomes more difficult to read clearly when animating at a greater speed. The speed varies and the scrolling must respond to changes in speed quickly.
Here's some code -
- (void) scrollIncrAmt:(float) amt {
_currentSpeedIncr = amt;
NSArray* arr = [SharedTickerInfo sharedTickerInfo].sDataArray;
DataObj* tdObj = [arr objectAtIndex:_row];
if ( ![tdObj isDirLeft] ) {
amt = -amt;
}
float scrollTo = self.scrollView.contentOffset.x + amt;
[scrollView setContentOffset:CGPointMake(scrollTo, 0.0f) animated:NO];
}
© Stack Overflow or respective owner