AMScrollingNavbar alternatives and similar libraries
Based on the "UI" category.
Alternatively, view AMScrollingNavbar alternatives based on common mentions on social networks and blogs.
-
Animated Tab Bar
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
Scrollable-GraphView
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift. -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
TLYShyNavBar
DISCONTINUED. Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars! -
SlideMenuControllerSwift
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift. -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
KMNavigationBarTransition
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically. -
StarWars.iOS
This component implements transition animation to crumble view-controller into tiny pieces. -
PaperOnboarding
:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion -
RazzleDazzle
A simple keyframe-based animation framework for iOS, written in Swift. Perfect for scrolling app intros. -
CircleMenu
:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion -
SKPhotoBrowser
Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of AMScrollingNavbar or a related project?
README
A custom UINavigationController that enables the scrolling of the navigation bar alongside the scrolling of an observed content view
Versioning notes
- Version
2.x
is written as a subclass ofUINavigationController
, in Swift. - Version
2.0.0
introduced Swift 2.0 syntax. - Version
3.0.0
introduced Swift 3.0 syntax. - Version
4.0.0
introduced Swift 4.0 syntax. - Version
5.1.0
introduced Swift 4.2 syntax.
If you are looking for the category implementation in Objective-C, make sure to checkout version 1.x
and prior, although the 2.x
is recomended.
Screenshot
Setup with CocoaPods
pod 'AMScrollingNavbar'
use_frameworks!
Setup with Carthage
github "andreamazz/AMScrollingNavbar"
Usage
Make sure to use ScrollingNavigationController
instead of the standard UINavigationController
. Either set the class of your UINavigationController
in your storyboard, or create programmatically a ScrollingNavigationController
instance in your code.
Use followScrollView(_: delay:)
to start following the scrolling of a scrollable view (e.g.: a UIScrollView
or UITableView
).
Swift
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.followScrollView(tableView, delay: 50.0)
}
}
Objective-C
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[(ScrollingNavigationController *)self.navigationController followScrollView:self.tableView delay:0 scrollSpeedFactor:1 collapseDirection:NavigationBarCollapseDirectionScrollDown followers:nil];
}
Use stopFollowingScrollview()
to stop the behaviour. Remember to call this function on disappear:
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.stopFollowingScrollView()
}
}
ScrollingNavigationViewController
To DRY things up you can let your view controller subclass ScrollingNavigationViewController
, which provides the base setup implementation. You will just need to call followScrollView(_: delay:)
:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.followScrollView(tableView, delay: 50.0)
}
}
Followers
To move another view, like a toolbar, alongside the navigation bar you can provide the view or multiple views as the followers
parameter. Since you might want to have the follower up or down, you'll have to specify the scroll direction of the view once it starts to follow the navigation bar:
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.followScrollView(tableView, delay: 50.0, followers: [NavigationBarFollower(view: customFooter, direction: .scrollDown)])
}
Note that when navigating away from the controller the followers might keep the scroll offset. Refer to Handling navigation for proper setup.
Additional scroll
If you want to furhter scroll the navigation bar out of the way, you can use the optional parameter additionalOffset
in the followScrollView
call.
Scrolling the TabBar
You can also pass a UITabBar
in the followers
array:
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.followScrollView(tableView, delay: 50.0, followers: [tabBarController.tabBar])
}
ScrollingNavigationControllerDelegate
You can set a delegate to receive a call when the state of the navigation bar changes:
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.scrollingNavbarDelegate = self
}
Delegate function:
func scrollingNavigationController(_ controller: ScrollingNavigationController, didChangeState state: NavigationBarState) {
switch state {
case .collapsed:
print("navbar collapsed")
case .expanded:
print("navbar expanded")
case .scrolling:
print("navbar is moving")
}
}
Handling navigation
If the view controller with the scroll view pushes new controllers, you should call showNavbar(animated:)
in your viewWillDisappear(animated:)
:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.showNavbar(animated: true)
}
}
Scrolling to top
When the user taps the status bar, by default a scrollable view scrolls to the top of its content. If you want to also show the navigation bar, make sure to include this in your controller:
func scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -> Bool {
if let navigationController = navigationController as? ScrollingNavigationController {
navigationController.showNavbar(animated: true, scrollToTop: true)
}
return true
}
Scroll speed
You can control the speed of the scrolling using the scrollSpeedFactor
optional parameter:
controller.followScrollView(view, delay: 0, scrollSpeedFactor: 2)
Check out the sample project for more details.
Changing UINavigationBar.tintColor
AMScrollingNavBar maintains its own copy of the UINavigationBar's tintColor
property. You need to notify the AMScrollingNavBar of a tint change by calling navBarTintUpdated()
:
navigationBar.tintColor = UIColor.red
controller.navBarTintUpdated()
Check out the sample project for more details.
Author
Andrea Mazzini. I'm available for freelance work, feel free to contact me.
Want to support the development of these free libraries? Buy me a coffee ☕️ via Paypal.
Contributors
Syo Ikeda and everyone kind enough to submit a pull request.
MIT License
The MIT License (MIT)
Copyright (c) 2014-2019 Andrea Mazzini
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Note that all licence references and agreements mentioned in the AMScrollingNavbar README section above
are relevant to that project's source code only.