CustomTabBarVC
具有修改选项的自定义标签栏。
自定义标签栏控制器库。根据自定义标签栏参数中指定的类型提供自定义选项。
作为 Pod 添加
pod 'CustomTabBarVC'
作为 Swift Package Manager 添加
https://github.com/vikramjagad/CustomTabBarVC.git
如何使用?
let subVC1 = UIStoryboard(name: "Sub", bundle: .main).instantiateViewController(withIdentifier: "SubViewController") as! SubViewController
subVC1.title = "VC 1"
let subVC2 = UIStoryboard(name: "Sub", bundle: .main).instantiateViewController(withIdentifier: "SubViewController") as! SubViewController
subVC2.title = "VC 2"
let subVC3 = UIStoryboard(name: "Sub", bundle: .main).instantiateViewController(withIdentifier: "SubViewController") as! SubViewController
subVC3.title = "VC 3"
tabParam.viewControllers = [subVC1, subVC2, subVC3]
tabParam.tabData = [TabModel(title: "VC 1", img: "ic_account", selectedImg: "", badgeCount: ""),
TabModel(title: "VC 2", img: "ic_camera", selectedImg: "", badgeCount: ""),
TabModel(title: "VC 3", img: "ic_delete", selectedImg: "", badgeCount: "")]
tabParam.place = .top
tabParam.type = .title
tabParam.equalWidth = false
tabParam.showSelectionView = false
tabParam.tabColor = .white
tabParam.titleColor = .black
tabParam.imgTintColor = .black
tabParam.selectedTitleColor = .red
tabParam.selectedImgTintColor = .red
tabParam.viewMainSpacing = 4
tabParam.imgLeadingSpacing = 16
tabParam.titleLeadingTrailingSpacing = 16
tabParam.tabHeight = 40
tabParam.addShadow = true
tabParam.cornerRadius = 0
tabParam.edgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 2, right: 0)
tabParam.shadowOffset = CGSize(width: 0, height: 1)
tabParam.cornerTo = [.bottomLeft, .bottomRight]
tabParam.titleFont = .systemFont(ofSize: 16)
tabParam.badgeBgColor = .red
tabParam.badgeTextFont = .systemFont(ofSize: 12)
tabParam.badgeTextColor = .white
tabParam.selectedViewColor = .red
tabParam.badgeHeight = 20
tabParam.hideBadgeOnSelection = true
tabParam.badgePosition = .aboveImage