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
36ce2bb1
Commit
36ce2bb1
authored
Mar 29, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MaterialCollectionViewCell example project, updated
parent
e5c999b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
Examples/Programmatic/MaterialCollectionView/MaterialCollectionView/ViewController.swift
+11
-5
No files found.
Examples/Programmatic/MaterialCollectionView/MaterialCollectionView/ViewController.swift
View file @
36ce2bb1
...
@@ -50,13 +50,15 @@ class ViewController: UIViewController {
...
@@ -50,13 +50,15 @@ class ViewController: UIViewController {
dataSourceItems
=
[
dataSourceItems
=
[
MaterialDataSourceItem
(
MaterialDataSourceItem
(
data
:
[
data
:
[
"placeholder"
:
"Field Placeholder"
"placeholder"
:
"Field Placeholder"
,
"detailLabelHidden"
:
false
],
],
height
:
80
height
:
80
),
),
MaterialDataSourceItem
(
MaterialDataSourceItem
(
data
:
[
data
:
[
"placeholder"
:
"Field Placeholder"
"placeholder"
:
"Field Placeholder"
,
"detailLabelHidden"
:
false
],
],
height
:
80
height
:
80
),
),
...
@@ -113,8 +115,11 @@ extension ViewController: MaterialCollectionViewDataSource {
...
@@ -113,8 +115,11 @@ extension ViewController: MaterialCollectionViewDataSource {
let
item
:
MaterialDataSourceItem
=
dataSourceItems
[
indexPath
.
item
]
let
item
:
MaterialDataSourceItem
=
dataSourceItems
[
indexPath
.
item
]
if
let
data
:
Dictionary
<
String
,
AnyObject
>
=
item
.
data
as?
Dictionary
<
String
,
AnyObject
>
{
if
let
data
:
Dictionary
<
String
,
AnyObject
>
=
item
.
data
as?
Dictionary
<
String
,
AnyObject
>
{
cell
.
pulseColor
=
nil
cell
.
pulseScale
=
false
let
textField
:
TextField
=
TextField
(
frame
:
CGRectMake
(
16
,
16
,
view
.
bounds
.
width
-
32
,
32
))
let
textField
:
TextField
=
TextField
(
frame
:
CGRectMake
(
16
,
16
,
view
.
bounds
.
width
-
32
,
32
))
//
textField.delegate = self
textField
.
delegate
=
self
textField
.
placeholder
=
"Email"
textField
.
placeholder
=
"Email"
textField
.
placeholderTextColor
=
MaterialColor
.
grey
.
base
textField
.
placeholderTextColor
=
MaterialColor
.
grey
.
base
textField
.
font
=
RobotoFont
.
regularWithSize
(
20
)
textField
.
font
=
RobotoFont
.
regularWithSize
(
20
)
...
@@ -135,7 +140,7 @@ extension ViewController: MaterialCollectionViewDataSource {
...
@@ -135,7 +140,7 @@ extension ViewController: MaterialCollectionViewDataSource {
textField
.
detailLabel
=
detailLabel
textField
.
detailLabel
=
detailLabel
textField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
detailLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
12
)
textField
.
detailLabelActiveColor
=
MaterialColor
.
red
.
accent3
textField
.
detailLabelActiveColor
=
MaterialColor
.
red
.
accent3
//
textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
//
textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
textField
.
detailLabelHidden
=
v
textField
.
detailLabelHidden
=
v
}
}
...
@@ -148,8 +153,9 @@ extension ViewController: MaterialCollectionViewDataSource {
...
@@ -148,8 +153,9 @@ extension ViewController: MaterialCollectionViewDataSource {
/// MaterialCollectionViewDelegate methods.
/// MaterialCollectionViewDelegate methods.
extension
ViewController
:
TextFieldDelegate
{
extension
ViewController
:
TextFieldDelegate
{
/// Handle textField return.
func
textFieldShouldReturn
(
textField
:
UITextField
)
->
Bool
{
func
textFieldShouldReturn
(
textField
:
UITextField
)
->
Bool
{
// handle detail label here.
(
textField
as?
TextField
)?
.
detailLabelHidden
=
false
return
true
return
true
}
}
}
}
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