Latest 1.0.3
Homepage https://github.com/Zedenem/ZMScrollableNavigationBar
License MIT
Platforms ios 7.0, requires ARC
Authors

Version
License
Platform

A UINavigationController subclass that allows the UINavigationBar to scroll with the content (iOS 8 only)

Click on the image to see a video preview:

Screenshot

Installation

With CocoaPods

Just add pod 'ZMScrollableNavigationBar', '~> 1.0.1' to your Podfile and run

$> pod install

Without CocoaPods

Just drag’n’drop UINavigationController+ZMScrollable.h and UINavigationController+ZMScrollable.m into your XCode project.

Usage

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];

TODO

  • Handle Rotation
  • Show UINavigationBar again when user quickly swipes up

Latest podspec

{
    "name": "ZMScrollableNavigationBar",
    "version": "1.0.3",
    "summary": "A UINavigationController category that allows the UINavigationBar to scroll with the content (iOS 8 only).",
    "homepage": "https://github.com/Zedenem/ZMScrollableNavigationBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Zouhair Mahieddine": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Zedenem/ZMScrollableNavigationBar.git",
        "tag": "1.0.3"
    },
    "source_files": "ZMScrollableNavigationBar/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This