Commit 14a9756e by Daniel Dahan Committed by GitHub

Merge pull request #904 from mohpor/development

Introducing tabBarItemsNormalColor and tabBarItemsSelectedColor
parents af62cb93 da219e20
......@@ -132,6 +132,14 @@ open class Button: UIButton, Pulseable, PulseableLayer {
}
}
/// 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.
- Parameter aDecoder: A NSCoder instance.
......
......@@ -139,7 +139,14 @@ open class TabBar: Bar {
internal weak var _delegate: _TabBarDelegate?
/// 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.
open var tabItemsContentEdgeInsetsPreset: EdgeInsetsPreset {
......@@ -195,6 +202,12 @@ open class TabBar: Bar {
}
}
/// TabBar items normal title color.
open var tabItemsNormalTitleColor: UIColor?
/// TabBar items selected title color.
open var tabItemsSelectedTitleColor: UIColor?
/// A reference to the line UIView.
open let line = UIView()
......@@ -272,6 +285,8 @@ fileprivate extension TabBar {
for v in tabItems {
v.grid.columns = 0
v.contentEdgeInsets = .zero
if Color.blue.base == v.titleColor { v.titleColor = tabItemsNormalTitleColor }
if nil == v.selectedTitleColor { v.selectedTitleColor = tabItemsSelectedTitleColor }
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