Is there a way to know if a UIScrollView
has reached the top or bottom inside
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView
willDecelerate:(BOOL)decelerate
?
thanks.
Implement the UIScrollViewDelegate
in your class, and then add this:
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
float scrollViewHeight = scrollView.frame.size.height;
float scrollContentSizeHeight = scrollView.contentSize.height;
float scrollOffset = scrollView.contentOffset.y;
if (scrollOffset == 0)
{
// then we are at the top
}
else if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
{
// then we are at the end
}
}
Hope this is what you are after! Else have a tinker by adding more conditions to the above code and NSLog the value of scrollOffset.