Latest | 1.0.0 |
---|---|
Homepage | https://github.com/crystalSETH/SFStaticNavigationBarController |
License | MIT |
Platforms | ios 9.0 |
Authors |
Description
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
Requirements
- iOS 9.0+
- Swift 3.2
- Currently only supports Portrait Orientations
Installation
SFStaticNavigationBarController is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'SFStaticNavigationBarController'
Usage
Initializing
let staticNavBarController = StaticNavigationBarController(centerViewController: myCenterViewController)
Setting View Controllers and Nav Bar Items
staticNavBarController.leftViewController = SomeOtherCenterViewController()
staticNavBarController.leftViewController = MyLeftViewController()
staticNavBarController.rightViewController = MyRightViewController()
staticNavBarController.leftBarButtonItem = SomeUIBarButtonItem()
staticNavBarController.rightBarButtonItem = SomeUIBarButtonItem()
staticNavBarController.centerItem = SomeUIView()
Accessing the Nav Controller
You can access this navigation controller as you normally would using myViewController.navigationController
. Also, available to all view controllers is:
var staticNavigationBarController: StaticNavigationBarController?
Navigation Functions
SFStaticNavigationBarController
has the same navigation functions has a regular UINavigationController
. For clarity, func popToRootViewController(animated: Bool) -> [UIViewController]?
pops to centerViewController
.
Transition Animations
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
Navigation Bar Slider
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
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
TODO
- [ ] improve README
- [ ] Write Tests
- [ ] Animation for navigation bar color changes
- [ ] Different slider animations
- [ ] More customization to slider
Author
crystalSETH, [email protected]
License
SFStaticNavigationBarController is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "SFStaticNavigationBarController", "version": "1.0.0", "summary": "A a custom UINavigationController with a static navigation bar.", "description": "SFStaticNavigationBarController is a custom UINavigationController with a static navigation barnu2022 A custom navigation bar with 3 possible states and an indicator for these statesnu2022 Transitions from left and from right based on where you are and where you are navigating to", "homepage": "https://github.com/crystalSETH/SFStaticNavigationBarController", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "crystalSETH": "[email protected]" }, "source": { "git": "https://github.com/crystalSETH/SFStaticNavigationBarController.git", "tag": "1.0.0" }, "platforms": { "ios": "9.0" }, "source_files": "SFStaticNavigationBarController/Classes/**/*", "pushed_with_swift_version": "3.0" }
Mon, 22 Jan 2018 10:40:43 +0000