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
3c738247
Commit
3c738247
authored
Aug 10, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: fixed alignment when initially calling on
parent
89833757
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Sources/iOS/TextField.swift
+11
-9
No files found.
Sources/iOS/TextField.swift
View file @
3c738247
...
@@ -50,7 +50,7 @@ public class TextField: UITextField {
...
@@ -50,7 +50,7 @@ public class TextField: UITextField {
}
}
/// Reference to the divider.
/// Reference to the divider.
public
private(set)
lazy
var
divider
:
CAShapeLayer
=
CAShapeLayer
()
public
private(set)
var
divider
:
CAShapeLayer
!
/// Divider height.
/// Divider height.
@IBInspectable
public
var
dividerHeight
:
CGFloat
=
1
@IBInspectable
public
var
dividerHeight
:
CGFloat
=
1
...
@@ -108,7 +108,7 @@ public class TextField: UITextField {
...
@@ -108,7 +108,7 @@ public class TextField: UITextField {
}
}
/// The placeholder UILabel.
/// The placeholder UILabel.
@IBInspectable
public
private(set)
lazy
var
placeholderLabel
:
UILabel
=
UILabel
(
frame
:
CGRect
.
zero
)
@IBInspectable
public
private(set)
var
placeholderLabel
:
UILabel
!
/// Placeholder textColor.
/// Placeholder textColor.
@IBInspectable
public
var
placeholderColor
:
UIColor
=
Color
.
darkText
.
others
{
@IBInspectable
public
var
placeholderColor
:
UIColor
=
Color
.
darkText
.
others
{
...
@@ -291,7 +291,6 @@ public class TextField: UITextField {
...
@@ -291,7 +291,6 @@ public class TextField: UITextField {
public
override
func
layoutSubviews
()
{
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutToSize
()
layoutToSize
()
}
}
...
@@ -305,7 +304,8 @@ public class TextField: UITextField {
...
@@ -305,7 +304,8 @@ public class TextField: UITextField {
/// Handles the text editing did begin state.
/// Handles the text editing did begin state.
public
func
handleEditingDidBegin
()
{
public
func
handleEditingDidBegin
()
{
dividerEditingDidBeginAnimation
()
layoutIfNeeded
()
dividerEditingDidBeginAnimation
()
placeholderEditingDidBeginAnimation
()
placeholderEditingDidBeginAnimation
()
}
}
...
@@ -342,11 +342,10 @@ public class TextField: UITextField {
...
@@ -342,11 +342,10 @@ public class TextField: UITextField {
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
super
.
placeholder
=
nil
super
.
placeholder
=
nil
clipsToBounds
=
false
clipsToBounds
=
false
borderStyle
=
.
none
borderStyle
=
.
none
backgroundColor
=
nil
backgroundColor
=
nil
textColor
=
Color
.
darkText
.
primary
textColor
=
Color
.
darkText
.
primary
font
=
RobotoFont
.
regularWithSize
(
size
:
16
)
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
prepareDivider
()
prepareDivider
()
preparePlaceholderLabel
()
preparePlaceholderLabel
()
...
@@ -354,11 +353,11 @@ public class TextField: UITextField {
...
@@ -354,11 +353,11 @@ public class TextField: UITextField {
prepareTargetHandlers
()
prepareTargetHandlers
()
prepareTextAlignment
()
prepareTextAlignment
()
}
}
/// Ensures that the components are sized correctly.
/// Ensures that the components are sized correctly.
public
func
layoutToSize
()
{
public
func
layoutToSize
()
{
if
!
animating
{
if
!
animating
{
layoutPlaceholderLabel
()
layoutPlaceholderLabel
()
layoutDetailLabel
()
layoutDetailLabel
()
layoutClearIconButton
()
layoutClearIconButton
()
layoutVisibilityIconButton
()
layoutVisibilityIconButton
()
...
@@ -482,14 +481,17 @@ public class TextField: UITextField {
...
@@ -482,14 +481,17 @@ public class TextField: UITextField {
/// Prepares the divider.
/// Prepares the divider.
private
func
prepareDivider
()
{
private
func
prepareDivider
()
{
divider
=
CAShapeLayer
()
dividerColor
=
Color
.
darkText
.
dividers
dividerColor
=
Color
.
darkText
.
dividers
layer
.
addSublayer
(
divider
)
layer
.
addSublayer
(
divider
)
}
}
/// Prepares the placeholderLabel.
/// Prepares the placeholderLabel.
private
func
preparePlaceholderLabel
()
{
private
func
preparePlaceholderLabel
()
{
placeholderLabel
=
UILabel
(
frame
:
CGRect
.
zero
)
placeholderColor
=
Color
.
darkText
.
others
placeholderColor
=
Color
.
darkText
.
others
addSubview
(
placeholderLabel
)
font
=
RobotoFont
.
regularWithSize
(
size
:
16
)
addSubview
(
placeholderLabel
)
}
}
/// Prepares the detailLabel.
/// Prepares the detailLabel.
...
...
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