Skip to content

zhihuilong/ZHTabBarController

Repository files navigation

ZHTabBarController

CI Status Coverage Status Version License Platform Swift version

An alternative for UITabBarController,which support all kinds of Custom TabBarController.

Requirements

Compatible with Xcode 8.2 / Swift 3.0

Installation

ZHTabBarController is available through CocoaPods. To install it, simply add the following line to your Podfile:

platform :ios, '8.0'
use_frameworks!

pod "ZHTabBarController"

Basic usage

1.Import ZHTabBarController module.

Swift:

import ZHTabBarController

Obj-C:

@import ZHTabBarController;

2.Make sure your AppDelegate confirm ZHTabBarControllerProtocol and implement two computing variables.

var childViewControllers: [UIViewController] { get }
var items: [ZHItemData] { get }

3.Replace the default 'applicationDidFinishLaunching(_ application: UIApplication)' method.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    window = UIWindow(frame: UIScreen.main.bounds)
    let vc = ZHTabBarController()
    vc.delegate = self
    window!.rootViewController = UINavigationController(rootViewController: vc)
    window!.makeKeyAndVisible()
    return true
}

Customization

You can customize following UI properties,

  1. tabBayStyle
  2. tabBarHeight
  3. tabBarColor
  4. tabBarItemTitleColor
  5. tabBarItemSelectedTitleColor
  6. ...
let vc = ZHTabBarController(style: .Default, tabBarHeight: 44)
vc.tabBarColor = UIColor.white
vc.itemTitleColor = UIColor.black
vc.itemSelectedTitleColor = UIColor.black

Todo

  • Travis CI
  • Code Coverage
  • Cocoadocs
  • Snapshot
  • Support more styles
  • Carthage support

Author

Zhihui, zhihui.me@gmail.com

License

ZHTabBarController is available under the MIT license. See the LICENSE file for more info.