Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
a64fc985
Commit
a64fc985
authored
Nov 07, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples issue-95: fixed TabBar image colors that were not correctly being set for a given state
parent
5434f208
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
Sources/iOS/Button.swift
+27
-0
Sources/iOS/TabBar.swift
+6
-18
No files found.
Sources/iOS/Button.swift
View file @
a64fc985
...
@@ -100,7 +100,15 @@ open class Button: UIButton, Pulseable, PulseableLayer {
...
@@ -100,7 +100,15 @@ open class Button: UIButton, Pulseable, PulseableLayer {
open
var
image
:
UIImage
?
{
open
var
image
:
UIImage
?
{
didSet
{
didSet
{
setImage
(
image
,
for
:
.
normal
)
setImage
(
image
,
for
:
.
normal
)
setImage
(
image
,
for
:
.
selected
)
setImage
(
image
,
for
:
.
highlighted
)
setImage
(
image
,
for
:
.
highlighted
)
setImage
(
image
,
for
:
.
disabled
)
if
#available(iOS 9, *)
{
setImage
(
image
,
for
:
.
application
)
setImage
(
image
,
for
:
.
focused
)
setImage
(
image
,
for
:
.
reserved
)
}
}
}
}
}
...
@@ -109,7 +117,15 @@ open class Button: UIButton, Pulseable, PulseableLayer {
...
@@ -109,7 +117,15 @@ open class Button: UIButton, Pulseable, PulseableLayer {
open
var
title
:
String
?
{
open
var
title
:
String
?
{
didSet
{
didSet
{
setTitle
(
title
,
for
:
.
normal
)
setTitle
(
title
,
for
:
.
normal
)
setTitle
(
title
,
for
:
.
selected
)
setTitle
(
title
,
for
:
.
highlighted
)
setTitle
(
title
,
for
:
.
highlighted
)
setTitle
(
title
,
for
:
.
disabled
)
if
#available(iOS 9, *)
{
setTitle
(
title
,
for
:
.
application
)
setTitle
(
title
,
for
:
.
focused
)
setTitle
(
title
,
for
:
.
reserved
)
}
guard
nil
!=
title
else
{
guard
nil
!=
title
else
{
return
return
...
@@ -129,6 +145,17 @@ open class Button: UIButton, Pulseable, PulseableLayer {
...
@@ -129,6 +145,17 @@ open class Button: UIButton, Pulseable, PulseableLayer {
didSet
{
didSet
{
setTitleColor
(
titleColor
,
for
:
.
normal
)
setTitleColor
(
titleColor
,
for
:
.
normal
)
setTitleColor
(
titleColor
,
for
:
.
highlighted
)
setTitleColor
(
titleColor
,
for
:
.
highlighted
)
setTitleColor
(
titleColor
,
for
:
.
disabled
)
if
nil
==
selectedTitleColor
{
setTitleColor
(
titleColor
,
for
:
.
selected
)
}
if
#available(iOS 9, *)
{
setTitleColor
(
titleColor
,
for
:
.
application
)
setTitleColor
(
titleColor
,
for
:
.
focused
)
setTitleColor
(
titleColor
,
for
:
.
reserved
)
}
}
}
}
}
...
...
Sources/iOS/TabBar.swift
View file @
a64fc985
...
@@ -35,18 +35,6 @@ open class TabItem: FlatButton {
...
@@ -35,18 +35,6 @@ open class TabItem: FlatButton {
super
.
prepare
()
super
.
prepare
()
pulseAnimation
=
.
none
pulseAnimation
=
.
none
}
}
open
override
var
isHighlighted
:
Bool
{
didSet
{
tintColor
=
titleColor
(
for
:
isHighlighted
?
.
highlighted
:
isSelected
?
.
selected
:
.
normal
)
}
}
open
override
var
isSelected
:
Bool
{
didSet
{
tintColor
=
titleColor
(
for
:
isSelected
?
.
selected
:
.
normal
)
}
}
}
}
@objc(TabItemState)
@objc(TabItemState)
...
@@ -508,18 +496,18 @@ extension TabBar {
...
@@ -508,18 +496,18 @@ extension TabBar {
fileprivate
extension
TabBar
{
fileprivate
extension
TabBar
{
/// Updates the tabItems colors.
/// Updates the tabItems colors.
func
updateTabItemColors
()
{
func
updateTabItemColors
()
{
let
normalColor
=
tabItemsColorForState
[
.
normal
]
let
normalColor
=
tabItemsColorForState
[
.
normal
]
!
let
selectedColor
=
tabItemsColorForState
[
.
selected
]
let
selectedColor
=
tabItemsColorForState
[
.
selected
]
!
let
highlightedColor
=
tabItemsColorForState
[
.
highlighted
]
let
highlightedColor
=
tabItemsColorForState
[
.
highlighted
]
!
for
v
in
tabItems
{
for
v
in
tabItems
{
v
.
setTitleColor
(
normalColor
,
for
:
.
normal
)
v
.
setTitleColor
(
normalColor
,
for
:
.
normal
)
v
.
setImage
(
v
.
image
?
.
tint
(
with
:
normalColor
),
for
:
.
normal
)
v
.
setTitleColor
(
selectedColor
,
for
:
.
selected
)
v
.
setTitleColor
(
selectedColor
,
for
:
.
selected
)
v
.
setImage
(
v
.
image
?
.
tint
(
with
:
selectedColor
),
for
:
.
selected
)
v
.
setTitleColor
(
highlightedColor
,
for
:
.
highlighted
)
v
.
setTitleColor
(
highlightedColor
,
for
:
.
highlighted
)
v
.
tintColor
=
normalColor
v
.
setImage
(
v
.
image
?
.
tint
(
with
:
highlightedColor
),
for
:
.
highlighted
)
}
}
selectedTabItem
?
.
tintColor
=
selectedColor
}
}
/// Updates the line colors.
/// Updates the line colors.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment