For a long time, the bar has been used as an interface to switch between different views on websites. A toolbar can replace this approach by providing more information at once and making it easier for users to navigate content.
The “custom tab bar pod” is a lightweight customized tabbar view that can be used with any app. The customization options are endless, and the author has provided detailed instructions on how to install it.
A lightweight tabbar view that may be modified.
Screenshots
Features
- Setup and configuration are simple. Make tabs with either a title or an image, or both.
- Configurations for Dynamic Tabs
- In a completion block, detect taps.
- In each tab, you may show or hide the badge value. Configure easily to meet your requirements.
- Specific tabs may be locked or unlocked.
- UINavigationBar and HHTabBarView may be easily shown and hidden.
- Lightweight and self-contained.
- HHTabBarView’s UI (LeftToRight or RightToLeft) may be changed to suit your requirements.
- Change the location of HHTabBarView according to the UI requirements. Top and bottom supports (Default).
Note that showing HHTabBarView at the top is not recommended. At the bottom, everything is always wonderful.
Installation
-
Add the HHTabBarView/Source folder to your project manually. And now you may utilize HHTabBarView.
-
– pod ‘HHTabBarView’ in CocoaPods
The CHANGELOG file for a certain version may be read.
Setup
Please keep in mind that HHTabBarView does not yet support UIStoryBoard. That is, you will have to programmatically construct HHTabBarView. HHTabBarView should be configured in AppDelegate. swift for your convenience
- HHTabBarView should be initialized and referenced.
let HHTabBarView.shared = hhTabBarView
- Keeping the default UITabBarController from iOS in mind.
allow for a reference HHTabBarView.shared.reference TabBarController = HHTabBarView.shared.reference UITabBarController
- UITabBarController was mentioned in the setup.
/Creating a storyboard reference let storyboard = UIStoryboard.init method setupReferenceUITabBarController() -> Void (name: “Main”, bundle: Bundle.main) /Creating a navigation controller for the first tab’s navigation. allow for navigating UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: “FirstViewControllerID”)) Controller1: UINavigationController = UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: “FirstViewControllerID”)) /Creating a navigation controller for the second tab’s navigation. allow for navigating UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: “SecondViewControllerID”)) Controller2: UINavigationController = UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: “SecondViewControllerID”)) /Reference your viewcontrollers in the referenced TabbarController. setViewControllers([navigationController1, navigationController2], animated: false) TabBarController
- Configure HHTabBarView
/Reference to HHTabBarView should be updated with the tabs required. setupHHTabBarView() -> func setupHHTabBarView() -> func setupHHTabBarView Void /Leave defaults for Default and Selected Background Colors. let chosen = UIColor.white TabColor = UIColor.white UIColor.init(red: 234/255, green: 218/255, blue: 195/255, alpha: 1.0) TabColor = UIColor.init(red: 234/255, green: 218/255, blue: 195/255, alpha: 1.0) if tabFont = UIFont.init, then (name: “Helvetica-Light”, size: 14.0) /Make your own tabs HHTabButton.init(withTitle: “Calendar”, tabImage: UIImage.init(named: “Calendar”)!, index: 0) let t1 = HHTabButton.init(withTitle: “Calendar”, tabImage: UIImage.init(named: “Calendar”)!, index: 0) tabFont = t1.titleLabel?.font UIColor.black = t1.titleLabel?.textColor t1.setHHTabBackgroundColor(default color) forState:.normal) TabColor, forState:.normal) setHHTabBackgroundColor t1 t2 t3 t4 t5 t6 t7 (color: selectedTabColor, forState: .selected) let t2 = HHTabButton.init(withTitle: “Refresh”, tabImage: UIImage.init(named: “Refresh”)! tabFont = t2.titleLabel?.font UIColor.black = t2.titleLabel?.textColor t2.setHHTabBackgroundColor(default color) forState:.normal) TabColor, forState:.normal) HHTabBackgroundColor = t2.setHHTabBackgroundColor (color: selectedTabColor, forState: .selected) / Because HHTabButton is a subclass of UIButton, you may customize it as much as you like. hhTabBarView.tabBarTabs = [t1, t2]; /Set Custom Tabs hhTabBarView.defaultIndex = 1; /Set the default index for HHTabBarView. hhTabBarView.tabChangeAnimationType =.none /Show Animation When Switching Tabs hhTabBarView.onTabTapped = (tabIndex) in print(“Selected Tab Index:(tabIndex)”) /Handle Tab Change Event hhTabBarView.onTabTapped = (tabIndex) in print(“Selected Tab Index:(tabIndex)”)
- Inside the, you’ll see a setup window for your application.
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool / Override point for customizing the program once it’s launched. Setup of the HHTabBarView setupHHTabBarView() is a reference to the UITabBarController() method () /Setup Application Selfie in the window self.window?.rootViewController = self.referenceTabBarController self.window?.makeKeyAndVisible() return true window = UIWindow.init(frame: UIScreen.main.bounds)
- Done! ✅
ToDo[s]
- [x] Add numerous examples of use and screenshots to the README.
You may keep an eye on HHTabBarView for changes. Keep an eye out for updates.
Have a suggestion on how to enhance this class? Please file a bug report.
Credits
Shah, Hemang
To reach me, please send me an email.
Thank you very much!!
Details may be found in the contributions.
License
The MIT License is a creative Commons license that allows you to (MIT)
For further information, see the LICENSE file.
GitHub
https://github.com/hemangshah/HHTabBarView
A lightweight customized tabbar view is a tab bar that has been customized to have bubbles. The bubble tab bar swift github is a project that shows how this can be done with Swift.
Related Tags
- top tab bar controller swift
- create custom tabbar
- custom tab bar controller storyboard
- add tab bar item without view controller swift
- scrollable tab bar ios swift