Created
November 10, 2016 22:09
-
-
Save rbreve/ca1fc9618987b79e862aff988efcfc15 to your computer and use it in GitHub Desktop.
Floating view inside UIScrollView
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 characters
| CGPoint currentOffset; | |
| //Save the initial scrollview offset when adding floating view on the UIScrollView | |
| currentOffset = scrollView.contentOffset; | |
| - (void) scrollViewDidScroll:(UIScrollView *)scrollView{ | |
| CGRect frame = self.floatingView.frame; | |
| frame.origin.x -= (currentOffset.x - scrollView.contentOffset.x); | |
| frame.origin.y -= (currentOffset.y - scrollView.contentOffset.y); | |
| self.floatingView.frame = titleFrame; | |
| currentOffset = scrollView.contentOffset; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment