SOTabBar 1.1.3

SOTabBar 1.1.3

ahmadalsofi 维护。



SOTabBar 1.1.3

  • Ahmadalsofi

SOTabBar

CocoaPods Platforms





📋需求

SOTabBar 需要 iOS 9.3 或更高版本,并与 Swift 4/5 兼容。

📲安装

CocoaPods

SOTabBar 通过 CocoaPods 提供

pod 'SOTabBar'

Carthage

SOTabBar 也通过 Carthage 提供

github "Ahmadalsofi/SOTabBar"

🚀使用

基本概念

  1. 设置视图控制器,传递您希望显示的视图控制器数组。
  2. 使主要视图控制器从 SOTabBarViewController 派生。
  3. 返回您的视图控制器数组
import UIKit
import SOTabBar
class MainViewController: SOTabBarViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let firstVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "First_ID")
        let secondVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Second_ID")
       
        firstVC.tabBarItem = UITabBarItem(title: "Home", image: UIImage(named: "firstImage"), selectedImage: UIImage(named: "firstSelectedImage"))
        secondVC.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "secondImage"), selectedImage: UIImage(named: "secondSelectedImage"))
	
        viewControllers = [firstVC, secondVC]
    }
}
  1. 您可以通过在主视图控制器中重写以下函数来触发标签栏动作
 override func soTabBar(_ tabBar: SOTabBarView, didSelectTabAt index: Int) {
      print("did Tapped On \(index)")
  }

🎨自定义

您应该在返回视图控制器数组之前设置自定义属性

class MainViewController: SOTabBarViewController {

    override func loadView() {
        super.loadView()
	    // SOTabBarSetting.propertyToCustomize = value
    }
}

tabBar高度

    SOTabBarSetting.tabBarHeight = 100.0

tabBar背景色

    SOTabBarSetting.tabBarTintColor = UIColor.red

tabBar背景

    SOTabBarSetting.tabBarBackground = UIColor.purple

tabBar圆形大小

    SOTabBarSetting.tabBarCircleSize = CGSize(width: 50.0, height: 50.0)
  	 // or 
    SOTabBarSetting.tabBarCircleSize = CGSize(width: 80.0, height: 80.0)

tabBar图标大小

    SOTabBarSetting.tabBarSizeImage = CGSize(width: 40.0, height: 40.0)

tabBar阴影颜色

    SOTabBarSetting.tabBarShadowColor = UIColor.red.cgcolor

tabBar选中图标大小

    SOTabBarSetting.tabBarSizeSelectedImage = CGSize(width: 40.0, height: 40.0)

tabBarAnimationDurationTime

    SOTabBarSetting.tabBarAnimationDurationTime = 2

👨‍💻 作者

❤️贡献

欢迎在 GitHub 上提交漏洞报告和拉取请求

👮‍♂️ 授权协议

该库符合 MIT 许可与开源条款提供。