diff --git a/CBTabBarController.podspec b/CBTabBarController.podspec
index 5f6969f..2f4c002 100644
--- a/CBTabBarController.podspec
+++ b/CBTabBarController.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CBTabBarController'
- s.version = '0.9.4'
+ s.version = '0.9.5'
s.summary = 'One another nice animated tabbar'
s.homepage = 'https://github.com/Cuberto/cb-tabbar'
s.license = 'MIT'
diff --git a/CBTabBarController/Classes/CBTabBarStyle.swift b/CBTabBarController/Classes/CBTabBarStyle.swift
index 5550eb9..f8f5115 100644
--- a/CBTabBarController/Classes/CBTabBarStyle.swift
+++ b/CBTabBarController/Classes/CBTabBarStyle.swift
@@ -48,7 +48,7 @@ public struct CBTabMenu {
}
public enum CBTabBarStyle {
- case flashy
+ case flashy(config: CBFlashyTabBarConfig?)
case fade
case gooey(menu: CBTabMenu)
}
@@ -65,8 +65,8 @@ internal extension CBTabBarStyle {
tabBar.buttonFactory = menuFactory
case .fade:
tabBar.buttonFactory = CBFadeTabButtonFactory()
- case .flashy:
- tabBar.buttonFactory = CBFlashyTabButtonFactory()
+ case let .flashy(config):
+ tabBar.buttonFactory = CBFlashyTabButtonFactory(config: config)
}
}
}
diff --git a/CBTabBarController/Classes/Flashy/CBFlashyTabBarButton.swift b/CBTabBarController/Classes/Flashy/CBFlashyTabBarButton.swift
index c5aa30a..935084e 100644
--- a/CBTabBarController/Classes/Flashy/CBFlashyTabBarButton.swift
+++ b/CBTabBarController/Classes/Flashy/CBFlashyTabBarButton.swift
@@ -18,6 +18,8 @@ class CBFlashyTabBarButton: CBTabBarButton {
var selectAnimation: CBTabItemAnimation?
var deselectAnimation: CBTabItemAnimation?
+ var config: CBFlashyTabBarConfig?
+
private var _isSelected: Bool = false
override var isSelected: Bool {
get {
@@ -82,7 +84,7 @@ class CBFlashyTabBarButton: CBTabBarButton {
override var tintColor: UIColor! {
didSet {
- tabImage.tintColor = tintColor.withAlphaComponent(0.4)
+ tabImage.tintColor = tintColor.withAlphaComponent(config?.deselectedOpacity ?? 0.4)
tabLabel.attributedText = (item as? CBExtendedTabItem)?.attributedTitle ?? attributedText(fortitle: item?.title)
dotView.backgroundColor = tintColor
badgeContainer.backgroundColor = item?.badgeColor ?? tintColor
diff --git a/CBTabBarController/Classes/Flashy/CBFlashyTabButtonFactory.swift b/CBTabBarController/Classes/Flashy/CBFlashyTabButtonFactory.swift
index 1c6aa91..6a4dc01 100644
--- a/CBTabBarController/Classes/Flashy/CBFlashyTabButtonFactory.swift
+++ b/CBTabBarController/Classes/Flashy/CBFlashyTabButtonFactory.swift
@@ -8,13 +8,28 @@
import UIKit
+public struct CBFlashyTabBarConfig {
+ let deselectedOpacity: CGFloat
+
+ public init(deselectedOpacity: CGFloat) {
+ self.deselectedOpacity = max(0.0, min(1.0, deselectedOpacity))
+ }
+}
+
class CBFlashyTabButtonFactory: CBTabButtonFactory {
-
+
+ let config: CBFlashyTabBarConfig?
+
+ init(config: CBFlashyTabBarConfig? = nil) {
+ self.config = config
+ }
+
private var animationSpeed: Double = 1.0
func buttons(forItems items: [UITabBarItem]) -> [CBTabBarButton] {
return items.map { item -> CBTabBarButton in
let button = CBFlashyTabBarButton(item: item)
+ button.config = config
button.selectAnimation = CBFlashyTabItemSelectAnimation(duration: 0.3 / animationSpeed)
button.deselectAnimation = CBFlashyTabItemDeselectAnimation(duration: 0.3 / animationSpeed)
return button
diff --git a/CBTabBarController/Info.plist b/CBTabBarController/Info.plist
index f9870de..dcd9492 100644
--- a/CBTabBarController/Info.plist
+++ b/CBTabBarController/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.9.3
+ 0.9.5
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
diff --git a/Example/ViewController.swift b/Example/ViewController.swift
index 1b4c816..96a2178 100644
--- a/Example/ViewController.swift
+++ b/Example/ViewController.swift
@@ -56,7 +56,7 @@ class ViewController: UIViewController {
@IBAction func btnFlashyPressed(_ sender: AnyObject) {
let tabBarController = createSampleTabController()
- tabBarController.style = .flashy
+ tabBarController.style = .flashy(config: nil)
self.navigationController?.pushViewController(tabBarController, animated: true)
}