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
20e6c252
Commit
20e6c252
authored
Jan 03, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added JSON
parent
4a66e2e2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
41 deletions
+48
-41
Examples/Programmatic/NavigationBarView/NavigationBarView.xcodeproj/project.pbxproj
+6
-0
Examples/Programmatic/NavigationBarView/NavigationBarView/ViewController.swift
+2
-2
Examples/Programmatic/TextField/TextField/ViewController.swift
+5
-5
Examples/Programmatic/TextView/TextView/ViewController.swift
+2
-2
README.md
+10
-9
Sources/TextField.swift
+16
-16
Sources/TextView.swift
+7
-7
No files found.
Examples/Programmatic/NavigationBarView/NavigationBarView.xcodeproj/project.pbxproj
View file @
20e6c252
...
...
@@ -7,6 +7,8 @@
objects
=
{
/* Begin PBXBuildFile section */
960590421C39E43400691E88
/* MaterialKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
960590411C39E43400691E88
/* MaterialKit.framework */
;
};
960590431C39E43400691E88
/* MaterialKit.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
960590411C39E43400691E88
/* MaterialKit.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
96D88C831C132C1800B91418
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C821C132C1800B91418
/* AppDelegate.swift */
;
};
96D88C851C132C1800B91418
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C841C132C1800B91418
/* ViewController.swift */
;
};
96D88C8A1C132C1800B91418
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C891C132C1800B91418
/* Assets.xcassets */
;
};
...
...
@@ -20,6 +22,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
960590431C39E43400691E88
/* MaterialKit.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
960590411C39E43400691E88
/* MaterialKit.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
MaterialKit.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/MaterialKit-gdulktuccbcfwbdfadtpxkworhyc/Build/Products/Debug-iphoneos/MaterialKit.framework"
;
sourceTree
=
"<absolute>"
;
};
96D88C7F1C132C1800B91418
/* NavigationBarView.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
NavigationBarView.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96D88C821C132C1800B91418
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96D88C841C132C1800B91418
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -40,6 +44,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
960590421C39E43400691E88
/* MaterialKit.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -49,6 +54,7 @@
96D88C761C132C1800B91418
=
{
isa
=
PBXGroup
;
children
=
(
960590411C39E43400691E88
/* MaterialKit.framework */
,
96D88C811C132C1800B91418
/* NavigationBarView */
,
96D88C801C132C1800B91418
/* Products */
,
);
...
...
Examples/Programmatic/NavigationBarView/NavigationBarView/ViewController.swift
View file @
20e6c252
...
...
@@ -31,8 +31,8 @@ class ViewController: UIViewController {
// prepareOrientationSupportExample()
// prepareDetailLabelExample()
// prepareBackgroundImageExample()
//
prepareButtonExample()
prepareAlignTitleAndDetailLabelToLeftExample
()
prepareButtonExample
()
//
prepareAlignTitleAndDetailLabelToLeftExample()
}
/**
...
...
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
20e6c252
...
...
@@ -50,8 +50,8 @@ class ViewController: UIViewController, TextFieldDelegate {
nameField
.
textColor
=
MaterialColor
.
black
nameField
.
titleLabel
=
UILabel
()
nameField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
nameField
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten1
nameField
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
nameField
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten1
nameField
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
nameField
.
clearButtonMode
=
.
WhileEditing
view
.
addSubview
(
nameField
)
}
...
...
@@ -68,13 +68,13 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField
.
textColor
=
MaterialColor
.
black
emailField
.
titleLabel
=
UILabel
()
emailField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten1
emailField
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
emailField
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten1
emailField
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
emailField
.
clearButtonMode
=
.
WhileEditing
emailField
.
detailLabel
=
UILabel
()
emailField
.
detailLabel
!.
text
=
"Email is incorrect."
emailField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
detailLabelActive
Text
Color
=
MaterialColor
.
red
.
accent3
emailField
.
detailLabelActiveColor
=
MaterialColor
.
red
.
accent3
view
.
addSubview
(
emailField
)
}
...
...
Examples/Programmatic/TextView/TextView/ViewController.swift
View file @
20e6c252
...
...
@@ -53,8 +53,8 @@ class ViewController: UIViewController, TextDelegate, TextViewDelegate {
textView
.
titleLabel
=
UILabel
()
textView
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textView
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten2
textView
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
textView
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten2
textView
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
view
.
addSubview
(
textView
)
textView
!.
translatesAutoresizingMaskIntoConstraints
=
false
...
...
README.md
View file @
20e6c252
...
...
@@ -81,15 +81,16 @@ A TextField is an excellent way to improve UX. Checkout the Examples directory f

```
swift
let
nameField
:
TextField
=
TextField
(
frame
:
CGRectMake
(
57
,
100
,
300
,
24
))
nameField
.
placeholder
=
"First Name"
nameField
.
font
=
RobotoFont
.
regularWithSize
(
20
)
nameField
.
textColor
=
MaterialColor
.
black
nameField
.
titleLabel
=
UILabel
()
nameField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
nameField
.
titleLabelNormalColor
=
MaterialColor
.
grey
.
lighten2
nameField
.
titleLabelHighlightedColor
=
MaterialColor
.
blue
.
accent3
nameField
.
clearButtonMode
=
.
WhileEditing
let
textField
:
TextField
=
TextField
(
frame
:
CGRectMake
(
57
,
100
,
300
,
24
))
textField
.
placeholder
=
"First Name"
textField
.
font
=
RobotoFont
.
regularWithSize
(
20
)
textField
.
textColor
=
MaterialColor
.
black
textField
.
titleLabel
=
UILabel
()
textField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
titleLabelTextColor
=
MaterialColor
.
grey
.
lighten1
textField
.
titleLabelActiveTextColor
=
MaterialColor
.
blue
.
accent3
textField
.
clearButtonMode
=
.
WhileEditing
view
.
addSubview
(
textField
)
// Add nameField to UIViewController.
view
.
addSubview
(
nameField
)
...
...
Sources/TextField.swift
View file @
20e6c252
...
...
@@ -235,15 +235,15 @@ public class TextField : UITextField {
}
/// The color of the titleLabel text when the textField is not active.
public
var
titleLabel
Text
Color
:
UIColor
?
{
public
var
titleLabelColor
:
UIColor
?
{
didSet
{
titleLabel
?
.
textColor
=
titleLabel
Text
Color
bottomBorderLayer
.
backgroundColor
=
titleLabel
Text
Color
?
.
CGColor
titleLabel
?
.
textColor
=
titleLabelColor
bottomBorderLayer
.
backgroundColor
=
titleLabelColor
?
.
CGColor
}
}
/// The color of the titleLabel text when the textField is active.
public
var
titleLabelActive
Text
Color
:
UIColor
?
public
var
titleLabelActiveColor
:
UIColor
?
/**
The detail UILabel that is displayed when the detailLabelHidden property
...
...
@@ -259,7 +259,7 @@ public class TextField : UITextField {
The color of the detailLabel text when the detailLabelHidden property
is set to false.
*/
public
var
detailLabelActive
Text
Color
:
UIColor
?
public
var
detailLabelActiveColor
:
UIColor
?
/**
:name: detailLabelHidden
...
...
@@ -267,11 +267,11 @@ public class TextField : UITextField {
public
var
detailLabelHidden
:
Bool
=
false
{
didSet
{
if
detailLabelHidden
{
bottomBorderLayer
.
backgroundColor
=
editing
?
titleLabelActive
TextColor
?
.
CGColor
:
titleLabelText
Color
?
.
CGColor
bottomBorderLayer
.
backgroundColor
=
editing
?
titleLabelActive
Color
?
.
CGColor
:
titleLabel
Color
?
.
CGColor
hideDetailLabel
()
}
else
{
detailLabel
?
.
textColor
=
detailLabelActive
Text
Color
bottomBorderLayer
.
backgroundColor
=
detailLabelActive
Text
Color
?
.
CGColor
detailLabel
?
.
textColor
=
detailLabelActiveColor
bottomBorderLayer
.
backgroundColor
=
detailLabelActiveColor
?
.
CGColor
showDetailLabel
()
}
}
...
...
@@ -398,12 +398,12 @@ public class TextField : UITextField {
}
if
0
==
text
?
.
utf16
.
count
{
titleLabel
?
.
textColor
=
titleLabel
Text
Color
bottomBorderLayer
.
backgroundColor
=
titleLabel
Text
Color
?
.
CGColor
titleLabel
?
.
textColor
=
titleLabelColor
bottomBorderLayer
.
backgroundColor
=
titleLabelColor
?
.
CGColor
detailLabelHidden
=
true
}
else
{
titleLabel
?
.
textColor
=
titleLabelActive
Text
Color
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabelActive
TextColor
?
.
CGColor
:
detailLabelActiveText
Color
?
.
CGColor
titleLabel
?
.
textColor
=
titleLabelActiveColor
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabelActive
Color
?
.
CGColor
:
detailLabelActive
Color
?
.
CGColor
}
}
...
...
@@ -411,8 +411,8 @@ public class TextField : UITextField {
internal
func
textFieldDidChange
(
textField
:
TextField
)
{
if
0
<
text
?
.
utf16
.
count
{
showTitleLabel
()
titleLabel
?
.
textColor
=
titleLabelActive
Text
Color
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabelActive
TextColor
?
.
CGColor
:
detailLabelActiveText
Color
?
.
CGColor
titleLabel
?
.
textColor
=
titleLabelActiveColor
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabelActive
Color
?
.
CGColor
:
detailLabelActive
Color
?
.
CGColor
}
else
if
0
==
text
?
.
utf16
.
count
{
hideTitleLabel
()
detailLabelHidden
=
true
...
...
@@ -426,8 +426,8 @@ public class TextField : UITextField {
}
else
if
0
==
text
?
.
utf16
.
count
{
hideTitleLabel
()
}
titleLabel
?
.
textColor
=
titleLabel
Text
Color
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabel
TextColor
?
.
CGColor
:
detailLabelActiveText
Color
?
.
CGColor
titleLabel
?
.
textColor
=
titleLabelColor
bottomBorderLayer
.
backgroundColor
=
detailLabelHidden
?
titleLabel
Color
?
.
CGColor
:
detailLabelActive
Color
?
.
CGColor
}
/// Manages the layout for the shape of the view instance.
...
...
Sources/TextView.swift
View file @
20e6c252
...
...
@@ -232,14 +232,14 @@ public class TextView: UITextView {
}
/// The color of the titleLabel text when the textView is not active.
public
var
titleLabel
Text
Color
:
UIColor
?
{
public
var
titleLabelColor
:
UIColor
?
{
didSet
{
titleLabel
?
.
textColor
=
titleLabel
Text
Color
titleLabel
?
.
textColor
=
titleLabelColor
}
}
/// The color of the titleLabel text when the textView is active.
public
var
titleLabelActive
Text
Color
:
UIColor
?
public
var
titleLabelActiveColor
:
UIColor
?
/// Placeholder UILabel view.
public
var
placeholderLabel
:
UILabel
?
{
...
...
@@ -410,9 +410,9 @@ public class TextView: UITextView {
v
.
frame
=
CGRectMake
(
0
,
-
h
,
bounds
.
width
,
h
)
v
.
text
=
placeholderLabel
?
.
text
if
0
==
text
?
.
utf16
.
count
{
v
.
textColor
=
titleLabel
Text
Color
v
.
textColor
=
titleLabelColor
}
else
{
v
.
textColor
=
titleLabelActive
Text
Color
v
.
textColor
=
titleLabelActiveColor
}
}
}
...
...
@@ -426,7 +426,7 @@ public class TextView: UITextView {
if
0
<
text
?
.
utf16
.
count
{
showTitleLabel
()
titleLabel
?
.
textColor
=
titleLabelActive
Text
Color
titleLabel
?
.
textColor
=
titleLabelActiveColor
}
else
if
0
==
text
?
.
utf16
.
count
{
hideTitleLabel
()
}
...
...
@@ -439,7 +439,7 @@ public class TextView: UITextView {
}
else
if
0
==
text
?
.
utf16
.
count
{
hideTitleLabel
()
}
titleLabel
?
.
textColor
=
titleLabel
Text
Color
titleLabel
?
.
textColor
=
titleLabelColor
}
/// Manages the layout for the shape of the view instance.
...
...
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