September 18, 2009, 12:13 am
iPhone OS2 UIScrollView on OS3 devices
I noticed a bug in the iPhone SDK today when building for 2.1 devices and deploying on OS 3+ devices. It seems that in some circumstances (repeatedly scrolling very quickly) the scrollViewDidEndDecelerating method does not get called when willDecelerate is false in the scrollViewDidEndDragging method. When you deploy to 2.1 devices scrollViewDidEndDragging is always called, and when you build and deploy for 3+ devices it is also always called; so I figure it's an issue with the SDK. There's a simple workaround:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerating{
  if(!declerating){
    [self scrollViewDidEndDecelerating: scrollView];
  }
}

This works fine and is perfectly logical, it just stumped me because it is only required in a very specific scenario. Hope this is helpful to someone!
No comments.
Add Comment
Name:

Comment: