- December 30, 2024
- Mins Read
ESTabBarController is a highly customizable TabBarController component, which is inherited from UITabBarController.
In real-world development, we may encounter the situation of customizing the UITabBar. For instance: change font style, add animation, and use bigger items. However it’s hard to do with UITabBarItem.
– | Feature | Description |
---|---|---|
1 | Default style | You can get a system-like style by initializing the TabBar with ESTabBarController directly.
UITabBarController style: ESTabBarController default style: |
2 | Default style with “More” item | If the items are more than the maximum number of displays, there will be a “More” item.
UITabBarController with “More”: ESTabBarController with “More”: |
3 | Mix UITabBarItem and ESTabBarItem | You can set any item as you want, including UITabBarItem and ESTabBarItem.
ESTabBar and UITabBar mixed style: ESTabBar and UITabBar mixed style with “More”: |
4 | UIKit attributes | ESTabBarController is compatible with UITabBarController, UITabBar and UITabBarItem’s most API attributes. You can migrate to ESTabBarController without any modification of the origin code.
Compatible with UITabBarController’s |
5 | Any nesting with UINavigationController | Developing withUITabBarController , there are two common ways to handle layers:
First : ├── UITabBarController └──── UINavigationController └────── UIViewController └──────── SubviewControllers Second : ├── UINavigationController └──── UITabBarController └────── UIViewController └──────── SubviewControllers In the first case, need to set In ESTabBarController, add Container views to UITabBar to be compatible with these two ways。 |
6 | Customizable style | With ESTabBarController, you can:
1. Customize selected item’s color and style: 2. Add selecting animation: 3. Customize item’s background color: 4. Add highlight animation: 5. Add animation to prompt users: 6. And much more …
|
7 | Customizable item’s size
Customizable click event |
You can easily customize item’s size using ESTabBarController.
When the button’s frame is larger than TabBar, HitTest makes the outer TabBar area click valid. In addition, ESTabBarController can customize click event, and through a block to callback super-layer to handle. With big item in the middle of TabBar: With a special hint style: Customize click event: |
8 | Default notification style | You can get a system-like notification style by initializing the TabBar with ESTabBarController directly.
UITabBarController notification style: ESTabBarController system-like notification style: |
9 | Customizable notification style | With ESTabBarController, you can:
1. Customize notification animation: 2. Customize prompt style: 3. And much more …
|
10 | Lottie | Through customizing ContentView, you are able to add Lottie’s LAAnimationView to Item(s) |
You can download and build ESTabBarControllerExample project, and you will find more examples to use ESTabBarController, and also more examples to customize UITabBar。
…
dependencies: [
.package(name: “ESTabBarController”, url: “https://github.com/eggswift/ESTabBarController.git”, from: “2.9.0-spm”)
]
…
pod “ESTabBarController-swift”
github “eggswift/ESTabBarController”
git clone https://github.com/eggswift/ESTabBarController.git
open ESTabBarController