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
1ace72ee
Unverified
Commit
1ace72ee
authored
Oct 16, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: working TextField, final part is rotation
parent
1acfef3f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
21 deletions
+6
-21
Examples/Programmatic/TextField/TextField.xcodeproj/project.pbxproj
+2
-3
Examples/Programmatic/TextField/TextField/ViewController.swift
+1
-3
Sources/iOS/TextField.swift
+3
-15
No files found.
Examples/Programmatic/TextField/TextField.xcodeproj/project.pbxproj
View file @
1ace72ee
...
...
@@ -107,7 +107,6 @@
TargetAttributes
=
{
96090AE31D9CDD2E00709CA6
=
{
CreatedOnToolsVersion
=
8.0
;
DevelopmentTeam
=
9Z76XCNLGL
;
ProvisioningStyle
=
Automatic
;
};
};
...
...
@@ -263,7 +262,7 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
9Z76XCNLGL
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
TextField/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.TextField
;
...
...
@@ -276,7 +275,7 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
9Z76XCNLGL
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
TextField/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.TextField
;
...
...
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
1ace72ee
...
...
@@ -46,12 +46,11 @@ class ViewController: UIViewController {
prepareNameField
()
prepareEmailField
()
preparePasswordField
()
prepareResignResponderButton
()
}
/// Programmatic update for the textField as it rotates.
override
func
willRotate
(
to
toInterfaceOrientation
:
UIInterfaceOrientation
,
duration
:
TimeInterval
)
{
emailField
.
width
=
view
.
bounds
.
height
-
2
*
constant
emailField
.
width
=
(
Device
.
isLandscape
?
view
.
height
:
view
.
width
)
-
2
*
constant
}
/// Prepares the resign responder button.
...
...
@@ -90,7 +89,6 @@ class ViewController: UIViewController {
}
private
func
prepareEmailField
()
{
emailField
=
ErrorTextField
(
frame
:
CGRect
(
x
:
constant
,
y
:
7
*
constant
,
width
:
view
.
width
-
(
2
*
constant
),
height
:
constant
))
emailField
.
text
=
"Daniel Dahan"
emailField
.
placeholder
=
"Email"
...
...
Sources/iOS/TextField.swift
View file @
1ace72ee
...
...
@@ -319,17 +319,6 @@ open class TextField: UITextField {
/// A reference to the visibilityIconButton.
open
private(set)
var
visibilityIconButton
:
IconButton
?
/**
`layoutIfNeeded` is called within `becomeFirstResponder` to
fix an issue that when the TextField calls `becomeFirstResponder`
immediately when launching an instance, the TextField is not
calculated correctly.
*/
open
override
func
becomeFirstResponder
()
->
Bool
{
layoutIfNeeded
()
return
super
.
becomeFirstResponder
()
}
open
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
guard
"placeholderLabel.text"
!=
keyPath
else
{
updatePlaceholderLabelColor
()
...
...
@@ -479,11 +468,12 @@ open class TextField: UITextField {
/// Layout the placeholderLabel.
open
func
layoutPlaceholderLabel
()
{
let
w
=
leftViewWidth
let
h
=
0
==
height
?
intrinsicContentSize
.
height
:
height
if
!
isEditing
&&
true
==
text
?
.
isEmpty
&&
isPlaceholderAnimated
{
placeholderLabel
.
frame
=
CGRect
(
x
:
w
,
y
:
bounds
.
origin
.
y
,
width
:
width
-
w
,
height
:
height
)
placeholderLabel
.
frame
=
CGRect
(
x
:
w
,
y
:
0
,
width
:
width
-
w
,
height
:
h
)
}
else
if
placeholderLabel
.
transform
.
isIdentity
{
placeholderLabel
.
frame
=
CGRect
(
x
:
w
,
y
:
bounds
.
origin
.
y
,
width
:
width
-
w
,
height
:
height
)
placeholderLabel
.
frame
=
CGRect
(
x
:
w
,
y
:
0
,
width
:
width
-
w
,
height
:
h
)
placeholderLabel
.
transform
=
CGAffineTransform
(
scaleX
:
0.75
,
y
:
0.75
)
switch
textAlignment
{
case
.
left
,
.
natural
:
...
...
@@ -493,7 +483,6 @@ open class TextField: UITextField {
default
:
break
}
placeholderLabel
.
y
=
-
placeholderLabel
.
height
+
placeholderVerticalOffset
placeholderLabel
.
textColor
=
placeholderNormalColor
}
else
{
switch
textAlignment
{
case
.
left
,
.
natural
:
...
...
@@ -581,7 +570,6 @@ open class TextField: UITextField {
}
s
.
placeholderLabel
.
y
=
-
s
.
placeholderLabel
.
height
+
s
.
placeholderVerticalOffset
s
.
placeholderLabel
.
textColor
=
s
.
placeholderActiveColor
})
{
[
weak
self
]
_
in
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