Latest | 0.4 |
---|---|
Homepage | https://github.com/luugiathuy/GTScrollNavigationBar |
License | BSD |
Platforms | ios 8.0, requires ARC |
Authors |
A lightweight scrollable UINavigationBar that follows a UIScrollView. This project was inspired by the navigation bar functionality seen in the Chrome, Facebook and Instagram iOS apps.
=======
Installation
CocoaPods
Add pod GTScrollNavigationBar
to your Podfile.
Manually
Add the GTScrollNavigationBar
folder to your project. GTScrollNavigationBar
uses ARC, so if you have a project that doesn’t use ARC, add the -fobjc-arc
compiler flag to the GTScrollNavigationBar
files.
Usage
Set up the navigation controller to use GTScrollNavigationBar
:
#import "GTScrollNavigationBar.h"
self.navController = [[UINavigationController alloc] initWithNavigationBarClass:[GTScrollNavigationBar class]
toolbarClass:nil];
[self.navController setViewControllers:@[self.mainViewController] animated:NO];
In your view controller which has a UIScrollView
, e.g. UITableViewController
, set the UIScrollView object to the GTScrollNavigationBar
in viewWillAppear:
or viewDidAppear:
by:
self.navigationController.scrollNavigationBar.scrollView = self.tableView;
To unfollow the scrollView, simply set scrollView
property to nil
self.navigationController.scrollNavigationBar.scrollView = nil;
Implement scrollViewDidScrollToTop:
in the view controller to reset the navigation bar’s position
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
{
[self.navigationController.scrollNavigationBar resetToDefaultPositionWithAnimation:NO];
}
Contact
Latest podspec
{ "name": "GTScrollNavigationBar", "version": "0.4", "summary": "A scrollable UINavigationBar that follows a UIScrollView", "homepage": "https://github.com/luugiathuy/GTScrollNavigationBar", "license": "BSD", "authors": { "Luu Gia Thuy": "[email protected]" }, "social_media_url": "http://twitter.com/luugiathuy", "platforms": { "ios": "8.0" }, "requires_arc": true, "source": { "git": "https://github.com/luugiathuy/GTScrollNavigationBar.git", "tag": "0.4" }, "source_files": "GTScrollNavigationBar/*" }
Fri, 04 Mar 2016 13:27:03 +0000