Commit 14a9756e by Daniel Dahan Committed by GitHub

Merge pull request #904 from mohpor/development

Introducing tabBarItemsNormalColor and tabBarItemsSelectedColor
parents af62cb93 da219e20
...@@ -131,6 +131,14 @@ open class Button: UIButton, Pulseable, PulseableLayer { ...@@ -131,6 +131,14 @@ open class Button: UIButton, Pulseable, PulseableLayer {
setTitleColor(titleColor, for: .highlighted) setTitleColor(titleColor, for: .highlighted)
} }
} }
/// Sets the selected titleColor for the button.
@IBInspectable
open var selectedTitleColor: UIColor? {
didSet {
setTitleColor(selectedTitleColor, for: .selected)
}
}
/** /**
An initializer that initializes the object with a NSCoder object. An initializer that initializes the object with a NSCoder object.
......
...@@ -139,7 +139,14 @@ open class TabBar: Bar { ...@@ -139,7 +139,14 @@ open class TabBar: Bar {
internal weak var _delegate: _TabBarDelegate? internal weak var _delegate: _TabBarDelegate?
/// The currently selected tabItem. /// The currently selected tabItem.
open internal(set) var selectedTabItem: TabItem? open internal(set) var selectedTabItem: TabItem? {
willSet {
selectedTabItem?.isSelected = false
}
didSet {
selectedTabItem?.isSelected = true
}
}
/// A preset wrapper around tabItems contentEdgeInsets. /// A preset wrapper around tabItems contentEdgeInsets.
open var tabItemsContentEdgeInsetsPreset: EdgeInsetsPreset { open var tabItemsContentEdgeInsetsPreset: EdgeInsetsPreset {
...@@ -194,7 +201,13 @@ open class TabBar: Bar { ...@@ -194,7 +201,13 @@ open class TabBar: Bar {
layoutSubviews() layoutSubviews()
} }
} }
/// TabBar items normal title color.
open var tabItemsNormalTitleColor: UIColor?
/// TabBar items selected title color.
open var tabItemsSelectedTitleColor: UIColor?
/// A reference to the line UIView. /// A reference to the line UIView.
open let line = UIView() open let line = UIView()
...@@ -272,7 +285,9 @@ fileprivate extension TabBar { ...@@ -272,7 +285,9 @@ fileprivate extension TabBar {
for v in tabItems { for v in tabItems {
v.grid.columns = 0 v.grid.columns = 0
v.contentEdgeInsets = .zero v.contentEdgeInsets = .zero
if Color.blue.base == v.titleColor { v.titleColor = tabItemsNormalTitleColor }
if nil == v.selectedTitleColor { v.selectedTitleColor = tabItemsSelectedTitleColor }
prepareLineAnimationHandler(tabItem: v) prepareLineAnimationHandler(tabItem: v)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment