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
62d6d3b1
Commit
62d6d3b1
authored
Apr 29, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated default colors and sizes, and added help properties to set the values when active
parent
867fc755
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
Examples/Programmatic/TextField/TextField/ViewController.swift
+5
-0
README.md
+1
-1
Sources/iOS/MTextField.swift
+33
-5
No files found.
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
62d6d3b1
...
...
@@ -158,6 +158,11 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField
.
delegate
=
self
emailField
.
clearButtonMode
=
.
WhileEditing
emailField
.
placeholderColor
=
MaterialColor
.
amber
.
darken4
emailField
.
placeholderActiveColor
=
MaterialColor
.
pink
.
base
emailField
.
detailColor
=
MaterialColor
.
indigo
.
accent1
emailField
.
dividerColor
=
MaterialColor
.
cyan
.
base
view
.
addSubview
(
emailField
)
}
...
...
README.md
View file @
62d6d3b1
...
...
@@ -194,7 +194,7 @@ under the TextField.

[
Learn More About TextField
](
http
s://github.com/CosmicMind/Material/wiki/TextF
ield
)
[
Learn More About TextField
](
http
://cosmicmind.sandbox.local/material/textf
ield
)
<a
name=
"textview"
></a>
#### TextView
...
...
Sources/iOS/MTextField.swift
View file @
62d6d3b1
...
...
@@ -126,7 +126,13 @@ public class MTextField : UITextField {
@IBInspectable
public
var
dividerActiveHeight
:
CGFloat
=
2
/// Sets the divider and tintColor.
@IBInspectable
public
var
dividerColor
:
UIColor
=
MaterialColor
.
darkText
.
dividers
@IBInspectable
public
var
dividerColor
:
UIColor
=
MaterialColor
.
darkText
.
dividers
{
didSet
{
if
!
editing
{
divider
.
backgroundColor
=
dividerColor
.
CGColor
}
}
}
/// The placeholderLabel font value.
@IBInspectable
public
override
var
font
:
UIFont
?
{
...
...
@@ -159,10 +165,26 @@ public class MTextField : UITextField {
@IBInspectable
public
private(set)
lazy
var
placeholderLabel
:
UILabel
=
UILabel
(
frame
:
CGRectZero
)
/// Placeholder textColor.
@IBInspectable
public
var
placeholderColor
:
UIColor
=
MaterialColor
.
darkText
.
others
@IBInspectable
public
var
placeholderColor
:
UIColor
=
MaterialColor
.
darkText
.
others
{
didSet
{
if
!
editing
{
if
let
v
:
String
=
placeholder
{
placeholderLabel
.
attributedText
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
placeholderColor
])
}
}
}
}
/// Placeholder active textColor.
@IBInspectable
public
var
placeholderActiveColor
:
UIColor
=
MaterialColor
.
blue
.
base
@IBInspectable
public
var
placeholderActiveColor
:
UIColor
=
MaterialColor
.
blue
.
base
{
didSet
{
if
editing
{
if
let
v
:
String
=
placeholder
{
placeholderLabel
.
attributedText
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
placeholderActiveColor
])
}
}
}
}
/// The detailLabel UILabel that is displayed.
@IBInspectable
public
private(set)
lazy
var
detailLabel
:
UILabel
=
UILabel
(
frame
:
CGRectZero
)
...
...
@@ -182,7 +204,13 @@ public class MTextField : UITextField {
}
/// Detail textColor.
@IBInspectable
public
var
detailColor
:
UIColor
=
MaterialColor
.
darkText
.
others
@IBInspectable
public
var
detailColor
:
UIColor
=
MaterialColor
.
darkText
.
others
{
didSet
{
if
let
v
:
String
=
detailLabel
.
text
{
detailLabel
.
attributedText
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
detailColor
])
}
}
}
/// Handles the textAlignment of the placeholderLabel.
public
override
var
textAlignment
:
NSTextAlignment
{
...
...
@@ -403,7 +431,7 @@ public class MTextField : UITextField {
/// Prepares the divider.
private
func
prepareDivider
()
{
divider
.
backgroundColor
=
MaterialColor
.
darkText
.
dividers
.
CGColor
divider
Color
=
MaterialColor
.
darkText
.
dividers
layer
.
addSublayer
(
divider
)
}
...
...
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