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
6ad5b6e5
Commit
6ad5b6e5
authored
May 26, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #402 from aleufms/development
Added custom placeholderPadding and detailDistance
parents
29775685
0881e196
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
Sources/iOS/TextField.swift
+11
-4
No files found.
Sources/iOS/TextField.swift
View file @
6ad5b6e5
...
...
@@ -49,6 +49,11 @@ public class TextField : UITextField {
layer
.
masksToBounds
=
value
}
}
/**
This property adds a padding to placeholder y position animation
*/
public
var
placeholderAnimationPadding
:
CGFloat
=
0
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
public
override
var
backgroundColor
:
UIColor
?
{
...
...
@@ -227,6 +232,9 @@ public class TextField : UITextField {
}
}
}
/// Vertical distance of detail label to divider
public
var
detailDistance
:
CGFloat
=
8
/// Handles the textAlignment of the placeholderLabel.
public
override
var
textAlignment
:
NSTextAlignment
{
...
...
@@ -513,7 +521,7 @@ public class TextField : UITextField {
/// Layout the detailLabel.
public
func
layoutDetailLabel
()
{
let
h
:
CGFloat
=
nil
==
detail
?
12
:
detailLabel
.
font
.
stringSize
(
detail
!
,
constrainedToWidth
:
Double
(
width
))
.
height
detailLabel
.
frame
=
CGRectMake
(
0
,
divider
.
frame
.
origin
.
y
+
8
,
width
,
h
)
detailLabel
.
frame
=
CGRectMake
(
0
,
divider
.
frame
.
origin
.
y
+
detailDistance
,
width
,
h
)
}
/// Layout the clearIconButton.
...
...
@@ -560,7 +568,7 @@ public class TextField : UITextField {
v
.
placeholderLabel
.
frame
.
origin
.
x
=
v
.
width
-
v
.
placeholderLabel
.
frame
.
width
default
:
break
}
v
.
placeholderLabel
.
frame
.
origin
.
y
=
-
v
.
placeholderLabel
.
frame
.
size
.
height
v
.
placeholderLabel
.
frame
.
origin
.
y
=
-
v
.
placeholderLabel
.
frame
.
size
.
height
+
v
.
placeholderAnimationPadding
v
.
placeholderLabel
.
textColor
=
v
.
placeholderActiveColor
}
})
{
[
weak
self
]
_
in
...
...
@@ -614,4 +622,4 @@ public class TextField : UITextField {
addTarget
(
self
,
action
:
#selector(
handleEditingDidBegin
)
,
forControlEvents
:
.
EditingDidBegin
)
addTarget
(
self
,
action
:
#selector(
handleEditingDidEnd
)
,
forControlEvents
:
.
EditingDidEnd
)
}
}
\ No newline at end of file
}
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