AZTabBarController alternatives and similar libraries
Based on the "Tab Bar" category.
Alternatively, view AZTabBarController alternatives based on common mentions on social networks and blogs.
-
animated-tab-bar
RAMAnimatedTabBarController is a Swift module for adding animation to tabbar items. -
adaptive-tab-bar
AdaptiveController is a 'Progressive Reduction' Swift module for adding custom states to Native or Custom iOS UI elements -
SwipeableTabBarController
UITabBarController with swipe interaction between its tabs. -
SwipeViewController
SwipeViewController is a Swift modification of RKSwipeBetweenViewControllers -
TabDrawer
Customizable TabBar UI element that allows you to run a block of code upon TabBarItem selection, written in Swift -
ExpandedTabBar
Very creative designed solution for "more" items in UITabBarController -
WormTabStrip
WormTabStrip Beatiful ViewPager For iOS written in Swift -
GGTabBar
Another UITabBar & UITabBarController (iOS Tab Bar) replacement, but uses Auto Layout for arranging it's views hierarchy. -
ESTabBarController
A tab bar controller for iOS that allows highlighting buttons and setting custom actions to them. -
KYWheelTabController
KYWheelTabController is a subclass of UITabBarController.It displays the circular menu instead of UITabBar. -
BEKCurveTabbar
compatible with XCode +10 and fully customizable via Interface_Builder panel. BEKCurveTabBar derived UITabBar class and compatible with every iOS devices. -
SSCustomTabMenu
Simple customizable iOS bottom menu with Tabbar. -
SuperBadges
Add emojis and colored dots as badges for your Tab Bar buttons
Get performance insights in less than 4 minutes
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of AZTabBarController or a related project?
README
A custom tab bar controller for iOS written in Swift 4.0
Screenshots
Installation
Cocoa Pods:
pod 'AZTabBar'
Manual:
Simply drag and drop the Sources
folder to your project.
Usage:
Create an array of String/UIImage:
//The icons that will be displayed on the tabs that are not currently selected
var icons = [String]()
icons.append("ic_star_outline")
icons.append("ic_history_outline")
icons.append("ic_phone_outline")
icons.append("ic_chat_outline")
icons.append("ic_settings_outline")
//The icons that will be displayed for each tab once they are selected.
var selectedIcons = [String]()
selectedIcons.append("ic_star_filled")
selectedIcons.append("ic_history_filled")
selectedIcons.append("ic_phone_filled")
selectedIcons.append("ic_chat_filled")
selectedIcons.append("ic_settings_filled")
Now initialize the controller object through the following method:
tabController = .insert(into: self, withTabIconNames: icons, andSelectedIconNames: selectedIcons)
Add controllers:
//if you are using storyboard:
let myChildViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ChildViewController")!
//if you are loading programmatically:
let myChildViewController = ChildViewController()
tabController.setViewController(myChildViewController, atIndex: 0)
Add actions:
tabController.setAction(atIndex: 3) {
//Your statments
print("Hello World")
}
Note that you can add both actions and view controllers at a certain index.
Customizations:
//default color of the icons on the buttons
tabController.defaultColor = .white
//the color of the icon when a menu is selected
tabController.selectedColor = .orange
//The color of the icon of a highlighted tab
tabController.highlightColor = .white
//The background color of the button of the highlighted tabs.
tabController.highlightedBackgroundColor = .green
//The background color of the tab bar
tabController.buttonsBackgroundColor = .black
//The color of the selection indicator.
tabController.selectionIndicatorColor = .green
// default is 3.0
tabController.selectionIndicatorHeight = 0
// change the seperator line color
tabController.separatorLineColor = .black
//hide or show the seperator line
tabController.separatorLineVisible = false
//Enable tab change animation that looks like facebook
tabController.animateTabChange = true
Extras:
Make tab look highlighted:
tabController.highlightButton(atIndex: 2)
Hide/Show the tab bar:
tabController.setBar(hidden: true, animated: true)
Add badge to menu (use nil value to remove existing badges):
tabController.setBadgeText("5", atIndex: 3)
Switch programmatically to a certain tab:
tabController.setIndex(2) //animated = true by default
//or
tabController.setIndex(2, animated: false)
Grant access to change the status bar style per tab:
override var childViewControllerForStatusBarStyle: UIViewController?{
return tabController
}
//Then implement the delegate method:
func tabBar(_ tabBar: AZTabBarController, statusBarStyleForIndex index: Int) -> UIStatusBarStyle {
return (index % 2) == 0 ? .default : .lightContent
}
Manage Titles
Adding Titles:
tabController.setTitle("Home", atIndex: 0)
tabController.setTitle("Search", atIndex: 1)
tabController.setTitle("Camera", atIndex: 2)
tabController.setTitle("Feed", atIndex: 3)
tabController.setTitle("Profile", atIndex: 4)
Show Title Only For Selected Index:
tabController.onlyShowTextForSelectedButtons = true
Access AZTabBarController from child view controllers:
I created an extension for UIViewController
which adds a var called currentTabBar
:
public var currentTabBar: AZTabBarController? { get }
You can call it like this:
currentTabBar?.setBadgeText("New Badge Value",atIndex: 2)
Delegate Methods:
These are the functions of the AZTabBarDelegate:
/// This function is called after `didMoveToTabAtIndex` is called. In order for this function to work you must override the var `childViewControllerForStatusBarStyle` in the root controller to return this instance of AZTabBarController.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the child view controller which you wish to set a status bar style for.
/// - Returns: The status bar style.
func tabBar(_ tabBar: AZTabBarController, statusBarStyleForIndex index: Int)-> UIStatusBarStyle
/// This function is called whenever user clicks the menu a long click. If returned false, the action will be ignored.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the child view controller which you wish to disable the long menu click for.
/// - Returns: true if you wish to allow long-click interaction for a specific tab, false otherwise.
func tabBar(_ tabBar: AZTabBarController, shouldLongClickForIndex index: Int)-> Bool
/// This function is used to enable/disable animation for a certian tab.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the tab.
/// - Returns: true if you wish to enable the animation, false otherwise.
func tabBar(_ tabBar: AZTabBarController, shouldAnimateButtonInteractionAtIndex index:Int)->Bool
/// This function is called whenever user taps one of the menu buttons.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the menu the user tapped.
func tabBar(_ tabBar: AZTabBarController, didSelectTabAtIndex index: Int)
/// This function is called whenever user taps and hold one of the menu buttons. Note that this function will not be called for a certain index if `shouldLongClickForIndex` is implemented and returns false for that very same index.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the menu the user long clicked.
func tabBar(_ tabBar: AZTabBarController, didLongClickTabAtIndex index:Int)
/// This function is called before the child view controllers are switched.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the controller which the tab bar will be switching to.
func tabBar(_ tabBar: AZTabBarController, willMoveToTabAtIndex index:Int)
/// This function is called after the child view controllers are switched.
///
/// - Parameters:
/// - tabBar: The current instance of AZTabBarController.
/// - index: The index of the controller which the tab bar had switched to.
func tabBar(_ tabBar: AZTabBarController, didMoveToTabAtIndex index: Int)
Credits
AZTabBarController was originally inspired by ESTabBarController that is written in Objective-C by ezescaruli.
Thanks to Tobaloidee for creating the logo.