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
23dde70e
Commit
23dde70e
authored
Apr 26, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temporary class MTextField added for new TextField
parent
a8c2438b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
16 deletions
+73
-16
Examples/Programmatic/MaterialCollectionView/MaterialCollectionView/ViewController.swift
+3
-6
Examples/Programmatic/TextField/TextField.xcodeproj/project.pbxproj
+6
-0
Examples/Programmatic/TextField/TextField/ViewController.swift
+55
-3
Material.xcodeproj/project.pbxproj
+4
-0
Sources/iOS/MTextField.swift
+0
-0
Sources/iOS/MaterialAnimation.swift
+4
-6
Sources/iOS/TextField.swift
+1
-1
No files found.
Examples/Programmatic/MaterialCollectionView/MaterialCollectionView/ViewController.swift
View file @
23dde70e
...
...
@@ -125,8 +125,7 @@ extension ViewController: MaterialCollectionViewDataSource {
textField
.
font
=
RobotoFont
.
regularWithSize
(
20
)
textField
.
textColor
=
MaterialColor
.
black
textField
.
titleLabel
=
UILabel
()
textField
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
titleLabelColor
=
MaterialColor
.
grey
.
base
textField
.
titleLabelActiveColor
=
MaterialColor
.
blue
.
accent3
...
...
@@ -135,10 +134,8 @@ extension ViewController: MaterialCollectionViewDataSource {
Used to display the error message, which is displayed when
the user presses the 'return' key.
*/
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"detail text..."
textField
.
detailLabel
=
detailLabel
textField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
detailLabel
.
text
=
"detail text..."
textField
.
detailLabel
.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
detailLabelActiveColor
=
MaterialColor
.
red
.
accent3
// textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
...
...
Examples/Programmatic/TextField/TextField.xcodeproj/project.pbxproj
View file @
23dde70e
...
...
@@ -7,6 +7,8 @@
objects
=
{
/* Begin PBXBuildFile section */
961776711CCE75EB0091B4F3
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961776701CCE75EB0091B4F3
/* Material.framework */
;
};
961776721CCE75EB0091B4F3
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961776701CCE75EB0091B4F3
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
966F57A11C226BAA009185B7
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57A01C226BAA009185B7
/* AppDelegate.swift */
;
};
966F57A31C226BAA009185B7
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57A21C226BAA009185B7
/* ViewController.swift */
;
};
966F57A81C226BAA009185B7
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57A71C226BAA009185B7
/* Assets.xcassets */
;
};
...
...
@@ -20,6 +22,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
961776721CCE75EB0091B4F3
/* Material.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
961776701CCE75EB0091B4F3
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
Material.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"
;
sourceTree
=
"<absolute>"
;
};
966F579D1C226BAA009185B7
/* TextField.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
TextField.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
966F57A01C226BAA009185B7
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
966F57A21C226BAA009185B7
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -40,6 +44,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
961776711CCE75EB0091B4F3
/* Material.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -49,6 +54,7 @@
966F57941C226BAA009185B7
=
{
isa
=
PBXGroup
;
children
=
(
961776701CCE75EB0091B4F3
/* Material.framework */
,
966F579F1C226BAA009185B7
/* TextField */
,
966F579E1C226BAA009185B7
/* Products */
,
);
...
...
Examples/Programmatic/TextField/TextField/ViewController.swift
View file @
23dde70e
...
...
@@ -38,8 +38,57 @@ under the TextField.
import
UIKit
import
Material
//extension TextField {
//
// func setDefaultLabelSpecs(titleColor titleColor: UIColor, detailColor: UIColor) {
// // ref: https://www.google.com/design/spec/components/text-fields.html#text-fields-labels
// // ref: https://www.google.com/design/spec/patterns/errors.html#errors-user-input-errors
// // ref: https://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-touch-target-size
// assert(height == 80, "Height must be 80, based on Material design spec.")
//
// backgroundColor = nil
//
// let derivedDetailLabelHeight: CGFloat = 15
// let paddingAboveAndBelowErrorText: CGFloat = 4
//
// detailLabel.font = RobotoFont.regularWithSize(12)
// detailLabelActiveColor = detailColor
// detailLabelAnimationDistance = lineLayerThickness + paddingAboveAndBelowErrorText
//
// lineLayerActiveColor = titleColor
// lineLayerColor = MaterialColor.darkText.dividers
// lineLayerDistance = 0 - (derivedDetailLabelHeight + (paddingAboveAndBelowErrorText * 2) + lineLayerThickness)
//
// let derivedTitleLabelHeight: CGFloat = 20
// let paddingAboveLabelText: CGFloat = 8
//
// titleLabelActiveColor = lineLayerActiveColor
// titleLabelAnimationDistance = 0 - (derivedTitleLabelHeight + paddingAboveLabelText)
//
// if let clearButton = clearButton {
// let touchTargetHeight: CGFloat = 48
// let spacing = (height - touchTargetHeight) / 2
// let origin = CGPoint(x: width - touchTargetHeight - spacing, y: spacing)
// let size = CGSize(width: touchTargetHeight, height: touchTargetHeight)
//
// clearButton.frame = CGRect(origin: origin, size: size)
//
// clearButton.contentHorizontalAlignment = .Right
//
// // Use PDF for better rendering
// let clearImage = UIImage(named: "Material/Navigation/Close")
// clearButton.setImage(clearImage, forState: .Normal)
// clearButton.setImage(clearImage, forState: .Highlighted)
//
// // Hide it since it bleeds over the lineLayer, and doesn't look good
// // with the horizontal alignment.
// clearButton.pulseOpacity = 0
// }
// }
//}
class
ViewController
:
UIViewController
,
TextFieldDelegate
{
private
var
nameField
:
TextField
!
private
var
nameField
:
M
TextField
!
private
var
emailField
:
TextField
!
override
func
viewDidLoad
()
{
...
...
@@ -56,14 +105,16 @@ class ViewController: UIViewController, TextFieldDelegate {
/// Prepares the name TextField.
private
func
prepareNameField
()
{
nameField
=
TextField
()
nameField
=
M
TextField
()
nameField
.
placeholder
=
"Name"
nameField
.
detail
=
"Error, incorrect password. yy ypp ggg"
nameField
.
placeholderTextColor
=
MaterialColor
.
green
.
base
view
.
addSubview
(
nameField
)
nameField
.
translatesAutoresizingMaskIntoConstraints
=
false
MaterialLayout
.
alignFromTop
(
view
,
child
:
nameField
,
top
:
100
)
MaterialLayout
.
alignToParentHorizontally
(
view
,
child
:
nameField
,
left
:
20
,
right
:
20
)
print
(
nameField
)
}
/// Prepares the email TextField.
...
...
@@ -73,6 +124,7 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField
=
TextField
(
frame
:
CGRectMake
(
x
,
200
,
w
,
24
))
emailField
.
placeholder
=
"Email"
emailField
.
delegate
=
self
emailField
.
text
=
"Hello World"
/*
Used to display the error message, which is displayed when
...
...
Material.xcodeproj/project.pbxproj
View file @
23dde70e
...
...
@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
96334EF61C8B84660083986B
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96334EF51C8B84660083986B
/* Assets.xcassets */
;
};
963832421B88DFD80015F710
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832361B88DFD80015F710
/* Material.framework */
;
};
9658F1E51CD0229D00B902C1
/* MTextField.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9658F1E41CD0229C00B902C1
/* MTextField.swift */
;
};
9660161D1CB2ED6C00AAB661
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966016131CB2ED6C00AAB661
/* Material.framework */
;
};
9660162A1CB2F04E00AAB661
/* Material.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C091C1328D800B91418
/* Material.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9679CEAB1CC69E080021685B
/* Material+UIImage+TintColor.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9679CEAA1CC69E080021685B
/* Material+UIImage+TintColor.swift */
;
};
...
...
@@ -196,6 +197,7 @@
963832361B88DFD80015F710
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Material.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832411B88DFD80015F710
/* Material.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
Material.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832591B88E31A0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
9658F1E41CD0229C00B902C1
/* MTextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MTextField.swift
;
sourceTree
=
"<group>"
;
};
966016131CB2ED6C00AAB661
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Material.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9660161C1CB2ED6C00AAB661
/* Material OSX Tests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
"Material OSX Tests.xctest"
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialViewTests.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -580,6 +582,7 @@
96BCB79C1CB40DC500C806FE
/* TextField.swift */
,
96BCB79D1CB40DC500C806FE
/* TextStorage.swift */
,
96BCB79E1CB40DC500C806FE
/* TextView.swift */
,
9658F1E41CD0229C00B902C1
/* MTextField.swift */
,
);
name
=
Text
;
sourceTree
=
"<group>"
;
...
...
@@ -882,6 +885,7 @@
96BCB7D11CB40DC500C806FE
/* MaterialSwitch.swift in Sources */
,
96BCB7BA1CB40DC500C806FE
/* MaterialCollectionView.swift in Sources */
,
96BCB7A31CB40DC500C806FE
/* CapturePreview.swift in Sources */
,
9658F1E51CD0229D00B902C1
/* MTextField.swift in Sources */
,
96BCB7BC1CB40DC500C806FE
/* MaterialCollectionViewDataSource.swift in Sources */
,
96BCB7C71CB40DC500C806FE
/* MaterialKeyframeAnimation.swift in Sources */
,
96BCB7BE1CB40DC500C806FE
/* MaterialCollectionViewLayout.swift in Sources */
,
...
...
Sources/iOS/MTextField.swift
0 → 100644
View file @
23dde70e
This diff is collapsed.
Click to expand it.
Sources/iOS/MaterialAnimation.swift
View file @
23dde70e
...
...
@@ -64,9 +64,7 @@ public func MaterialAnimationFillModeToValue(mode: MaterialAnimationFillMode) ->
public
typealias
MaterialAnimationDelayCancelBlock
=
(
cancel
:
Bool
)
->
Void
public
struct
MaterialAnimation
{
/**
:name: delay
*/
/// Delay helper method.
public
static
func
delay
(
time
:
NSTimeInterval
,
completion
:
()
->
Void
)
->
MaterialAnimationDelayCancelBlock
?
{
func
dispatch_later
(
completion
:
()
->
Void
)
{
...
...
@@ -109,7 +107,7 @@ public struct MaterialAnimation {
/**
:name: animateWithDuration
*/
public
static
func
animateWithDuration
(
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
options
:
UIViewAnimationOptions
?
=
nil
,
completion
:
(()
->
Void
)?
=
nil
)
{
public
static
func
animateWithDuration
(
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
completion
:
(()
->
Void
)?
=
nil
)
{
CATransaction
.
begin
()
CATransaction
.
setAnimationDuration
(
duration
)
CATransaction
.
setCompletionBlock
(
completion
)
...
...
@@ -134,9 +132,9 @@ public struct MaterialAnimation {
/**
:name: animateWithDelay
*/
public
static
func
animateWithDelay
(
delay
d
:
CFTimeInterval
,
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
options
:
UIViewAnimationOptions
?
=
nil
,
completion
:
(()
->
Void
)?
=
nil
)
{
public
static
func
animateWithDelay
(
delay
d
:
CFTimeInterval
,
duration
:
CFTimeInterval
,
animations
:
(()
->
Void
),
completion
:
(()
->
Void
)?
=
nil
)
{
delay
(
d
)
{
animateWithDuration
(
duration
,
animations
:
animations
,
options
:
options
,
completion
:
completion
)
animateWithDuration
(
duration
,
animations
:
animations
,
completion
:
completion
)
}
}
}
Sources/iOS/TextField.swift
View file @
23dde70e
...
...
@@ -632,7 +632,7 @@ public class TextField : UITextField {
/// Layout the clearButton.
private
func
layoutClearButton
()
{
if
0
<
width
&&
0
<
height
{
clearButton
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
//
clearButton.frame = CGRectMake(width - height, 0, height, height)
}
}
...
...
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