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
Show 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 @@
...
@@ -7,6 +7,8 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* 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 */
;
};
96D88C831C132C1800B91418
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C821C132C1800B91418
/* AppDelegate.swift */
;
};
96D88C851C132C1800B91418
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C841C132C1800B91418
/* ViewController.swift */
;
};
96D88C851C132C1800B91418
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C841C132C1800B91418
/* ViewController.swift */
;
};
96D88C8A1C132C1800B91418
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C891C132C1800B91418
/* Assets.xcassets */
;
};
96D88C8A1C132C1800B91418
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C891C132C1800B91418
/* Assets.xcassets */
;
};
...
@@ -20,6 +22,7 @@
...
@@ -20,6 +22,7 @@
dstPath
=
""
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
dstSubfolderSpec
=
10
;
files
=
(
files
=
(
960590431C39E43400691E88
/* MaterialKit.framework in Embed Frameworks */
,
);
);
name
=
"Embed Frameworks"
;
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
...
@@ -27,6 +30,7 @@
...
@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference 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
;
};
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>"
;
};
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>"
;
};
96D88C841C132C1800B91418
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -40,6 +44,7 @@
...
@@ -40,6 +44,7 @@
isa
=
PBXFrameworksBuildPhase
;
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
960590421C39E43400691E88
/* MaterialKit.framework in Frameworks */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -49,6 +54,7 @@
...
@@ -49,6 +54,7 @@
96D88C761C132C1800B91418
=
{
96D88C761C132C1800B91418
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
960590411C39E43400691E88
/* MaterialKit.framework */
,
96D88C811C132C1800B91418
/* NavigationBarView */
,
96D88C811C132C1800B91418
/* NavigationBarView */
,
96D88C801C132C1800B91418
/* Products */
,
96D88C801C132C1800B91418
/* Products */
,
);
);
...
...
Examples/Programmatic/NavigationBarView/NavigationBarView/ViewController.swift
View file @
20e6c252
...
@@ -31,8 +31,8 @@ class ViewController: UIViewController {
...
@@ -31,8 +31,8 @@ class ViewController: UIViewController {
// prepareOrientationSupportExample()
// prepareOrientationSupportExample()
// prepareDetailLabelExample()
// prepareDetailLabelExample()
// prepareBackgroundImageExample()
// prepareBackgroundImageExample()
//
prepareButtonExample()
prepareButtonExample
()
prepareAlignTitleAndDetailLabelToLeftExample
()
//
prepareAlignTitleAndDetailLabelToLeftExample()
}
}
/**
/**
...
...
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
20e6c252
...
@@ -50,8 +50,8 @@ class ViewController: UIViewController, TextFieldDelegate {
...
@@ -50,8 +50,8 @@ class ViewController: UIViewController, TextFieldDelegate {
nameField
.
textColor
=
MaterialColor
.
black
nameField
.
textColor
=
MaterialColor
.
black
nameField
.
titleLabel
=
UILabel
()
nameField
.
titleLabel
=
UILabel
()
nameField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
nameField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
nameField
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten1
nameField
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten1
nameField
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
nameField
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
nameField
.
clearButtonMode
=
.
WhileEditing
nameField
.
clearButtonMode
=
.
WhileEditing
view
.
addSubview
(
nameField
)
view
.
addSubview
(
nameField
)
}
}
...
@@ -68,13 +68,13 @@ class ViewController: UIViewController, TextFieldDelegate {
...
@@ -68,13 +68,13 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField
.
textColor
=
MaterialColor
.
black
emailField
.
textColor
=
MaterialColor
.
black
emailField
.
titleLabel
=
UILabel
()
emailField
.
titleLabel
=
UILabel
()
emailField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten1
emailField
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten1
emailField
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
emailField
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
emailField
.
clearButtonMode
=
.
WhileEditing
emailField
.
clearButtonMode
=
.
WhileEditing
emailField
.
detailLabel
=
UILabel
()
emailField
.
detailLabel
=
UILabel
()
emailField
.
detailLabel
!.
text
=
"Email is incorrect."
emailField
.
detailLabel
!.
text
=
"Email is incorrect."
emailField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
emailField
.
detailLabelActive
Text
Color
=
MaterialColor
.
red
.
accent3
emailField
.
detailLabelActiveColor
=
MaterialColor
.
red
.
accent3
view
.
addSubview
(
emailField
)
view
.
addSubview
(
emailField
)
}
}
...
...
Examples/Programmatic/TextView/TextView/ViewController.swift
View file @
20e6c252
...
@@ -53,8 +53,8 @@ class ViewController: UIViewController, TextDelegate, TextViewDelegate {
...
@@ -53,8 +53,8 @@ class ViewController: UIViewController, TextDelegate, TextViewDelegate {
textView
.
titleLabel
=
UILabel
()
textView
.
titleLabel
=
UILabel
()
textView
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textView
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textView
.
titleLabel
Text
Color
=
MaterialColor
.
grey
.
lighten2
textView
.
titleLabelColor
=
MaterialColor
.
grey
.
lighten2
textView
.
titleLabelActive
Text
Color
=
MaterialColor
.
blue
.
accent3
textView
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
view
.
addSubview
(
textView
)
view
.
addSubview
(
textView
)
textView
!.
translatesAutoresizingMaskIntoConstraints
=
false
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
...
@@ -81,15 +81,16 @@ A TextField is an excellent way to improve UX. Checkout the Examples directory f


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