TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | May 2015 |
Maintained by Zedenem.
A UINavigationController subclass that allows the UINavigationBar to scroll with the content (iOS 8 only)
Click on the image to see a video preview:
Using a UIScrollView
in your UIViewController
, you can simply hook up the scroll to the UINavigationBar
animation. Here are the two methods you need to implement:
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.navigationController.topOffset = -self.scrollView.contentOffset.y;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.navigationController.topOffset = -scrollView.contentOffset.y;
}
ZMScrollableNavigationBar also provides a method to reset the navigation bar's offset (for example when another view is pushed). Just call:
[self.navigationController resetTopOffset];
UINavigationBar
again when user quickly swipes up