Created
December 11, 2012 09:05
-
-
Save tomazsh/4257206 to your computer and use it in GitHub Desktop.
Moving navigation bar in UINavigationController along with UIScrollView
This file contains 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
- (void)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
CALayer *layer = self.navigationController.navigationBar.layer; | |
CGFloat y = scrollView.contentOffset.y+scrollView.contentInset.top; | |
if (y >= 0.0f) { | |
layer.transform = CATransform3DMakeTranslation(0.0f, -y, 0.0f); | |
} else { | |
layer.transform = CATransform3DIdentity; | |
} | |
} |
Author
tomazsh
commented
Nov 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment