PutItOnMyTabBar 1.2

PutItOnMyTabBar 1.2

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最后发布2017 年 8 月
SwiftSwift 版本3.0
SPM支持 SPM

Jake Wagstaff 维护。



  • 作者:
  • jnwagstaff

PutItOnMyTabBar🍻

UITabBarController 的可自定义子类

示例

普通

alt text

滑块

alt text

背景

alt text

小滑块

alt text

需求

  • Swift 3.0
  • iOS 10.0+
  • Xcode 8.0

特性

  • 易于实现
  • 更改滑块的宽度和高度
  • 更改任何元素的颜色

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

用法

要获取全部功能,请在您的 TabBarController 文件中导入 PutItOnMyTabBar

import PutItOnMyTabBar

简单地继承 'PutItOnMyTabBarController' 并覆盖必要的函数进行自定义!

class MyTabBarController: PutItOnMyTabBarController{
    // MARK: Mandatory Functions Child Class must override
    //Specifies how many tabs there are
    override func numberOfTabs() -> Int{
        return 3
    }

    //Gives TabBar all of the images it needs for when a tab is highlighted (in order of Tabs)
    override func highLightedImages() -> [UIImage] {
        return [image1, image2, image3]
    }

    //Gives TabBar all of the images it needs for when a tab is not selected (in order of Tabs) 
    override func unHighlightedImages() -> [UIImage] {
        return [image1, image2, image3]
    }

    // MARK: Optional Overrides 
    // Gives Background to Tab Bar - Default is white 
    override func backgroundColor() -> UIColor{
        return .white
    }

    // Optional Slider View that moves to selected Tab - Default is clear
    override func sliderColor() -> UIColor {
        return .clear
    }

    // Sets the height of a slider as a percentage of the total tab bar height - Default is 10%
    override func sliderHeightMultiplier() -> CGFloat {
        return 0.1
    }

    // Sets the sliders width as a percentage of each tab bars width - Default is 100%
    override func sliderWidthMultiplier() -> CGFloat {
        return 1.0
    }
}

干杯!🍻

Jake Wagstaff – [email protected]

在 MIT 许可下分发。有关更多信息,请参阅 LICENSE