Search Results

Search found 1 results on 1 pages for 'bibac'.

Page 1/1 | 1 

  • iPhone UIScrollView / setContentOffset weirdness

    - by bibac
    Hi, I have a weird issue with setContentOffset which I don't seem to be able to solve: I'm trying to build an "endless" scroll view, so I'd like to reset the content offset at a certain position. With the code below setContentOffset will be called at x=160px. If I drag the scroll view my log looks like this: offset: 158 offset: 159 offset: 160 offset: 80 offset: 160 What happens is that my setContentOffset (to 80) is performed, when I keep on dragging UIScrollView seem to have forgotten about it and continues at 160. Even weirder: When I set animated:YES it works. Maybe a timing issue? When I call setContentOffset from within scrollViewDidScroll, scrollViewDidScroll will be called again. - (void)scrollViewDidScroll:(UIScrollView *)scrollView { NSInteger tileNo = floor(scrollView.contentOffset.x / 80); NSLog(@"offset: %f, tile: %d, lastTile: %d", scrollView.contentOffset.x, tileNo, lastTileNo); if (tileNo > lastTileNo) { [scrollView setContentOffset:CGPointMake(80, 0) animated:NO]; } lastTileNo = tileNo; } Thanks for helping me out, Stephan

    Read the article

1