SFStaticNavigationBarController
is a custom UINavigationController
with a static navigation bar.
- A custom navigation bar with 3 possible states and an indicator for these states
- Transitions from left and from right based on what position you are in and where are you navigating to
- iOS 9.0+
- Swift 3.2
- Currently only supports Portrait Orientations
SFStaticNavigationBarController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SFStaticNavigationBarController'
let staticNavBarController = StaticNavigationBarController(centerViewController: myCenterViewController)
staticNavBarController.leftViewController = SomeOtherCenterViewController()
staticNavBarController.leftViewController = MyLeftViewController()
staticNavBarController.rightViewController = MyRightViewController()
staticNavBarController.leftBarButtonItem = SomeUIBarButtonItem()
staticNavBarController.rightBarButtonItem = SomeUIBarButtonItem()
staticNavBarController.centerItem = SomeUIView()
You can access this navigation controller as you normally would using myViewController.navigationController
. Also, available to all view controllers is:
var staticNavigationBarController: StaticNavigationBarController?
SFStaticNavigationBarController
has the same navigation functions has a regular UINavigationController
. For clarity, func popToRootViewController(animated: Bool) -> [UIViewController]?
pops to centerViewController
.
Currently, custom view controller transition animations are not supported. The default transition animations are "natural" depending on what the active position is. Push and pop transitions are also "natural." Accessible variables pertaining to transition animations are:
var shouldAnimateTransitions: Bool // default is true
var shouldAnimateAcrossCenter: Bool // default is true
var transitionDuration: TimeInterval // default is 0.3s
You can customize the slider in the navigation bar using someStaticNavBarController.staticNavigationBar.slider
. Below are
the available variables to adjust.
var leftMargin: CGFloat // default: 8.0
var leftSize: CGSize: // default: CGSize(width: 35.0, height: 2)
var centerSize: CGSize // default: CGSize(width: 35.0, height: 2)
var rightMargin: CGFloat // default: 8.0
var rightSize: CGSize // default: CGSize(width: 35.0, height: 2)
var color: UIColor // default: .darkGray
To run the example project, clone the repo, and run pod install
from the Example directory first.
- improve README
- Write Tests
- Animation for navigation bar color changes
- Different slider animations
- More customization to slider
crystalSETH, sethfolley@gmail.com
SFStaticNavigationBarController is available under the MIT license. See the LICENSE file for more info.