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
f59dc603
Commit
f59dc603
authored
Dec 05, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated README with CardView example 3
parent
f8d2977c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
17 deletions
+31
-17
Examples/CardView/CardView/ViewController.swift
+22
-16
README.md
+9
-1
No files found.
Examples/CardView/CardView/ViewController.swift
View file @
f59dc603
...
...
@@ -27,9 +27,9 @@ class ViewController: UIViewController {
// Examples of using CardView.
// Uncomment different examples and read
// the comments below.
// prepareGeneralCardView()
// prepareCardViewWithout
Divider
()
prepareCardViewWith
BackgroundImag
e
()
// prepareGeneralCardView
Example
()
// prepareCardViewWithout
PulseBackgroundImageExample
()
prepareCardViewWith
AlteredAlignmentExampl
e
()
}
/**
...
...
@@ -41,10 +41,10 @@ class ViewController: UIViewController {
}
/**
:name: prepareGeneralCardView
:name: prepareGeneralCardView
Example
:description: General usage example.
*/
private
func
prepareGeneralCardView
()
{
private
func
prepareGeneralCardView
Example
()
{
let
cardView
:
CardView
=
CardView
()
// Title label.
...
...
@@ -88,24 +88,30 @@ class ViewController: UIViewController {
}
/**
:name: prepareCardViewWithout
Divider
:description: An example of the CardView without the
divider line between buttons
.
:name: prepareCardViewWithout
PulseBackgroundImageExample
:description: An example of the CardView without the
pulse animation and an added background image
.
*/
private
func
prepareCardViewWithout
Divider
()
{
private
func
prepareCardViewWithout
PulseBackgroundImageExample
()
{
let
cardView
:
CardView
=
CardView
()
cardView
.
divider
=
false
cardView
.
backgroundColor
=
MaterialColor
.
teal
.
darken1
cardView
.
backgroundColor
=
MaterialColor
.
red
.
darken1
cardView
.
pulseScale
=
false
cardView
.
pulseColor
=
nil
// Image.
cardView
.
image
=
UIImage
(
named
:
"iTunesArtwork"
)?
.
resize
(
toWidth
:
400
)
cardView
.
contentsGravity
=
.
BottomRight
// Title label.
let
titleLabel
:
UILabel
=
UILabel
()
titleLabel
.
text
=
"
Data-Driven
"
titleLabel
.
text
=
"
MaterialKit
"
titleLabel
.
textColor
=
MaterialColor
.
white
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
cardView
.
titleLabel
=
titleLabel
// Detail label
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build
scalable data-driven apps with GraphKit
."
detailLabel
.
text
=
"Build
beautiful software
."
detailLabel
.
textColor
=
MaterialColor
.
white
detailLabel
.
numberOfLines
=
0
cardView
.
detailLabel
=
detailLabel
...
...
@@ -119,8 +125,8 @@ class ViewController: UIViewController {
btn1
.
setImage
(
img1
,
forState
:
.
Normal
)
btn1
.
setImage
(
img1
,
forState
:
.
Highlighted
)
// Add buttons to
righ
t side.
cardView
.
righ
tButtons
=
[
btn1
]
// Add buttons to
lef
t side.
cardView
.
lef
tButtons
=
[
btn1
]
// To support orientation changes, use MaterialLayout.
view
.
addSubview
(
cardView
)
...
...
@@ -130,10 +136,10 @@ class ViewController: UIViewController {
}
/**
:name: prepareCardViewWith
BackgroundImag
e
:description: An example of the CardView with a
background image
.
:name: prepareCardViewWith
AlteredAlignmentExampl
e
:description: An example of the CardView with a
n altered alignment of the UI elements
.
*/
private
func
prepareCardViewWith
BackgroundImag
e
()
{
private
func
prepareCardViewWith
AlteredAlignmentExampl
e
()
{
let
cardView
:
CardView
=
CardView
()
cardView
.
dividerInsetsRef
.
left
=
100
cardView
.
titleLabelInsetsRef
.
left
=
100
...
...
README.md
View file @
f59dc603
...
...
@@ -24,10 +24,18 @@ Right out of the box to a fully customized configuration, CardView always stands


Easily remove the pulse animation and add a background image for an entirely new feel.

Adjust the alignment of the UI elements to create different configurations of the CardView.

### ImageCardView
Bold and attractive, ImageCardView is
### License
[
AGPL-3.0
](
http://choosealicense.com/licenses/agpl-3.0/
)
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