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
4055f4ae
Commit
4055f4ae
authored
Feb 17, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added MaterialTableViewCell
parent
175f214b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
39 deletions
+7
-39
Examples/Programmatic/SideNavigationViewController/SideNavigationViewController/LeftViewController.swift
+2
-2
Examples/Programmatic/SideNavigationViewController/SideNavigationViewController/RightViewController.swift
+2
-2
Sources/MaterialTableViewCell.swift
+3
-35
No files found.
Examples/Programmatic/SideNavigationViewController/SideNavigationViewController/LeftViewController.swift
View file @
4055f4ae
...
...
@@ -107,7 +107,7 @@ class LeftViewController: UIViewController {
/// Prepares the tableView.
private
func
prepareTableView
()
{
tableView
.
registerClass
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"
Cell"
)
tableView
.
registerClass
(
MaterialTableViewCell
.
self
,
forCellReuseIdentifier
:
"MaterialTableView
Cell"
)
tableView
.
dataSource
=
self
tableView
.
delegate
=
self
tableView
.
separatorStyle
=
.
None
...
...
@@ -128,7 +128,7 @@ extension LeftViewController: UITableViewDataSource {
/// Prepares the cells within the tableView.
func
tableView
(
tableView
:
UITableView
,
cellForRowAtIndexPath
indexPath
:
NSIndexPath
)
->
UITableViewCell
{
let
cell
:
UITableViewCell
=
tableView
.
dequeueReusableCellWithIdentifier
(
"Cell"
,
forIndexPath
:
indexPath
)
as
UI
TableViewCell
let
cell
:
MaterialTableViewCell
=
tableView
.
dequeueReusableCellWithIdentifier
(
"MaterialTableViewCell"
,
forIndexPath
:
indexPath
)
as!
Material
TableViewCell
cell
.
backgroundColor
=
MaterialColor
.
clear
let
item
:
Cell
=
items
[
indexPath
.
row
]
...
...
Examples/Programmatic/SideNavigationViewController/SideNavigationViewController/RightViewController.swift
View file @
4055f4ae
...
...
@@ -78,7 +78,7 @@ class RightViewController: UIViewController {
/// Prepares the tableView.
private
func
prepareTableView
()
{
tableView
.
registerClass
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"
Cell"
)
tableView
.
registerClass
(
MaterialTableViewCell
.
self
,
forCellReuseIdentifier
:
"MaterialTableView
Cell"
)
tableView
.
backgroundColor
=
MaterialColor
.
clear
tableView
.
dataSource
=
self
tableView
.
delegate
=
self
...
...
@@ -100,7 +100,7 @@ extension RightViewController: UITableViewDataSource {
/// Prepares the cells within the tableView.
func
tableView
(
tableView
:
UITableView
,
cellForRowAtIndexPath
indexPath
:
NSIndexPath
)
->
UITableViewCell
{
let
cell
:
UITableViewCell
=
tableView
.
dequeueReusableCellWithIdentifier
(
"Cell"
,
forIndexPath
:
indexPath
)
as
UI
TableViewCell
let
cell
:
MaterialTableViewCell
=
tableView
.
dequeueReusableCellWithIdentifier
(
"MaterialTableViewCell"
,
forIndexPath
:
indexPath
)
as!
Material
TableViewCell
cell
.
backgroundColor
=
MaterialColor
.
clear
let
item
:
Cell
=
items
[
indexPath
.
row
]
...
...
Sources/MaterialTableViewCell.swift
View file @
4055f4ae
...
...
@@ -107,9 +107,6 @@ public class MaterialTableViewCell: UITableViewCell {
}
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
height
=
value
}
}
}
...
...
@@ -125,9 +122,6 @@ public class MaterialTableViewCell: UITableViewCell {
}
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
width
=
value
}
}
}
...
...
@@ -191,9 +185,6 @@ public class MaterialTableViewCell: UITableViewCell {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
...
...
@@ -205,23 +196,6 @@ public class MaterialTableViewCell: UITableViewCell {
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public
var
shape
:
MaterialShape
=
.
None
{
didSet
{
if
.
None
!=
shape
{
if
width
<
height
{
frame
.
size
.
width
=
height
}
else
{
frame
.
size
.
height
=
width
}
}
}
}
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
None
{
didSet
{
...
...
@@ -284,7 +258,6 @@ public class MaterialTableViewCell: UITableViewCell {
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
layoutShape
()
layoutVisualLayer
()
}
}
...
...
@@ -396,6 +369,8 @@ public class MaterialTableViewCell: UITableViewCell {
public
func
prepareView
()
{
prepareVisualLayer
()
selectionStyle
=
.
None
pulseColor
=
MaterialColor
.
grey
.
lighten1
pulseScale
=
false
imageView
?
.
userInteractionEnabled
=
false
textLabel
?
.
userInteractionEnabled
=
false
detailTextLabel
?
.
userInteractionEnabled
=
false
...
...
@@ -405,7 +380,7 @@ public class MaterialTableViewCell: UITableViewCell {
internal
func
prepareVisualLayer
()
{
visualLayer
.
zPosition
=
0
visualLayer
.
masksToBounds
=
true
layer
.
addSublayer
(
visualLayer
)
contentView
.
layer
.
addSublayer
(
visualLayer
)
}
/// Manages the layout for the visualLayer property.
...
...
@@ -415,13 +390,6 @@ public class MaterialTableViewCell: UITableViewCell {
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
}
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
layer
.
cornerRadius
=
width
/
2
}
}
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
...
...
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