Created
January 8, 2014 14:27
-
-
Save Abeansits/8317545 to your computer and use it in GitHub Desktop.
Revisions
-
Abeansits created this gist
Jan 8, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // // UIScrollView+Extensions.h // // @interface UIScrollView (Extensions) /// Returns true if the content has been scrolled all the way to the top (by pulling the content up). - (BOOL)isScrolledToTop; /// Returns true if the content has been scrolled all the way to the bottom (by pulling the content down). - (BOOL)isScrolledToBottom; @end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ // // UIScrollView+Extensions.m // // #import "UIScrollView+Extensions.h" @implementation UIScrollView (Extensions) - (BOOL)isScrolledToTop { return (self.contentOffset.y <= [self verticalOffsetToTop]); } - (BOOL)isScrolledToBottom { return (self.contentOffset.y >= [self verticalOffsetToBottom]); } #pragma mark - Utils - (CGFloat)verticalOffsetToTop { CGFloat verticalOffsetTop = self.contentInset.top; return -verticalOffsetTop; } - (CGFloat)verticalOffsetToBottom { CGFloat verticalOffsetBottom = (self.contentSize.height + self.contentInset.bottom - self.bounds.size.height); return verticalOffsetBottom; } @end