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
9c3c58e6
Unverified
Commit
9c3c58e6
authored
Nov 07, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: minor updates to TextField when updating placeholder text color
parent
c0b0aa1a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
Sources/iOS/TextField.swift
+5
-12
No files found.
Sources/iOS/TextField.swift
View file @
9c3c58e6
...
@@ -465,20 +465,12 @@ extension TextField {
...
@@ -465,20 +465,12 @@ extension TextField {
/// Updates the placeholderLabel attributedText.
/// Updates the placeholderLabel attributedText.
fileprivate
func
updatePlaceholderLabelColor
()
{
fileprivate
func
updatePlaceholderLabelColor
()
{
guard
let
v
=
placeholder
else
{
return
}
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
}
}
/// Updates the detailLabel attributedText.
/// Updates the detailLabel attributedText.
fileprivate
func
updateDetailLabelColor
()
{
fileprivate
func
updateDetailLabelColor
()
{
guard
let
v
=
detail
else
{
detailLabel
.
textColor
=
detailColor
return
}
detailLabel
.
attributedText
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
detailColor
])
}
}
}
}
...
@@ -610,6 +602,8 @@ extension TextField {
...
@@ -610,6 +602,8 @@ extension TextField {
/// The animation for the placeholder when editing begins.
/// The animation for the placeholder when editing begins.
fileprivate
func
placeholderEditingDidBeginAnimation
()
{
fileprivate
func
placeholderEditingDidBeginAnimation
()
{
updatePlaceholderLabelColor
()
guard
isPlaceholderAnimated
else
{
guard
isPlaceholderAnimated
else
{
return
return
}
}
...
@@ -618,8 +612,6 @@ extension TextField {
...
@@ -618,8 +612,6 @@ extension TextField {
return
return
}
}
updatePlaceholderLabelColor
()
isAnimating
=
true
isAnimating
=
true
UIView
.
animate
(
withDuration
:
0.15
,
animations
:
{
[
weak
self
]
in
UIView
.
animate
(
withDuration
:
0.15
,
animations
:
{
[
weak
self
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
...
@@ -644,6 +636,8 @@ extension TextField {
...
@@ -644,6 +636,8 @@ extension TextField {
/// The animation for the placeholder when editing ends.
/// The animation for the placeholder when editing ends.
fileprivate
func
placeholderEditingDidEndAnimation
()
{
fileprivate
func
placeholderEditingDidEndAnimation
()
{
updatePlaceholderLabelColor
()
guard
isPlaceholderAnimated
else
{
guard
isPlaceholderAnimated
else
{
return
return
}
}
...
@@ -661,7 +655,6 @@ extension TextField {
...
@@ -661,7 +655,6 @@ extension TextField {
s
.
placeholderLabel
.
transform
=
CGAffineTransform
.
identity
s
.
placeholderLabel
.
transform
=
CGAffineTransform
.
identity
s
.
placeholderLabel
.
x
=
s
.
leftViewWidth
s
.
placeholderLabel
.
x
=
s
.
leftViewWidth
s
.
placeholderLabel
.
y
=
0
s
.
placeholderLabel
.
y
=
0
s
.
placeholderLabel
.
textColor
=
s
.
placeholderNormalColor
})
{
[
weak
self
]
_
in
})
{
[
weak
self
]
_
in
self
?
.
isAnimating
=
false
self
?
.
isAnimating
=
false
}
}
...
...
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