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
2984dc02
Commit
2984dc02
authored
Dec 06, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated MaterialView example
parent
75013611
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
2 deletions
+100
-2
Examples/ImageCardView/ImageCardView/ViewController.swift
+0
-1
README.md
+100
-1
No files found.
Examples/ImageCardView/ImageCardView/ViewController.swift
View file @
2984dc02
...
...
@@ -157,7 +157,6 @@ class ViewController: UIViewController {
imageCardView
.
translatesAutoresizingMaskIntoConstraints
=
false
MaterialLayout
.
alignFromTop
(
view
,
child
:
imageCardView
,
top
:
100
)
MaterialLayout
.
alignToParentHorizontally
(
view
,
child
:
imageCardView
,
left
:
20
,
right
:
20
)
}
}
README.md
View file @
2984dc02
...
...
@@ -362,10 +362,109 @@ Bold and attractive, ImageCardView is the next step from a CardView. In the Exam

Remove elements, such as the details to create a fresh look for your images.
```
swift
let
imageCardView
:
ImageCardView
=
ImageCardView
()
// Image.
imageCardView
.
image
=
UIImage
.
imageWithColor
(
MaterialColor
.
cyan
.
darken1
,
size
:
CGSizeMake
(
UIScreen
.
mainScreen
()
.
bounds
.
width
-
CGFloat
(
40
),
150
))
// Title label.
let
titleLabel
:
UILabel
=
UILabel
()
titleLabel
.
text
=
"Welcome Back!"
titleLabel
.
textColor
=
MaterialColor
.
white
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
imageCardView
.
titleLabel
=
titleLabel
imageCardView
.
titleLabelInsetsRef
.
top
=
100
// Detail label
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
imageCardView
.
detailLabel
=
detailLabel
// Yes button.
let
btn1
:
FlatButton
=
FlatButton
()
btn1
.
pulseColor
=
MaterialColor
.
cyan
.
lighten1
btn1
.
pulseFill
=
true
btn1
.
pulseScale
=
false
btn1
.
setTitle
(
"YES"
,
forState
:
.
Normal
)
btn1
.
setTitleColor
(
MaterialColor
.
cyan
.
darken1
,
forState
:
.
Normal
)
// No button.
let
btn2
:
FlatButton
=
FlatButton
()
btn2
.
pulseColor
=
MaterialColor
.
cyan
.
lighten1
btn2
.
pulseFill
=
true
btn2
.
pulseScale
=
false
btn2
.
setTitle
(
"NO"
,
forState
:
.
Normal
)
btn2
.
setTitleColor
(
MaterialColor
.
cyan
.
darken1
,
forState
:
.
Normal
)
// Add buttons to left side.
imageCardView
.
leftButtons
=
[
btn1
,
btn2
]
// To support orientation changes, use MaterialLayout.
view
.
addSubview
(
imageCardView
)
imageCardView
.
translatesAutoresizingMaskIntoConstraints
=
false
MaterialLayout
.
alignFromTop
(
view
,
child
:
imageCardView
,
top
:
100
)
MaterialLayout
.
alignToParentHorizontally
(
view
,
child
:
imageCardView
,
left
:
20
,
right
:
20
)
```
Remove elements, such as details to create a fresh look for your images.

```
swift
let
imageCardView
:
ImageCardView
=
ImageCardView
()
imageCardView
.
divider
=
false
// Image.
imageCardView
.
image
=
UIImage
(
named
:
"MaterialKitImageCardViewBackgroundImage"
)
// Title label.
let
titleLabel
:
UILabel
=
UILabel
()
titleLabel
.
text
=
"Material Design"
titleLabel
.
textColor
=
MaterialColor
.
white
titleLabel
.
font
=
RobotoFont
.
regularWithSize
(
24
)
imageCardView
.
titleLabel
=
titleLabel
imageCardView
.
titleLabelInsetsRef
.
top
=
80
// Check button.
let
img1
:
UIImage
?
=
UIImage
(
named
:
"ic_check_blue_grey_darken_4"
)
let
btn1
:
FlatButton
=
FlatButton
()
btn1
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten1
btn1
.
pulseFill
=
true
btn1
.
pulseScale
=
false
btn1
.
setImage
(
img1
,
forState
:
.
Normal
)
btn1
.
setImage
(
img1
,
forState
:
.
Highlighted
)
// Star button.
let
img2
:
UIImage
?
=
UIImage
(
named
:
"ic_star_blue_grey_darken_4"
)
let
btn2
:
FlatButton
=
FlatButton
()
btn2
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten1
btn2
.
pulseFill
=
true
btn2
.
pulseScale
=
false
btn2
.
setImage
(
img2
,
forState
:
.
Normal
)
btn2
.
setImage
(
img2
,
forState
:
.
Highlighted
)
// Delete button.
let
img3
:
UIImage
?
=
UIImage
(
named
:
"ic_delete_blue_grey_darken_4"
)
let
btn3
:
FlatButton
=
FlatButton
()
btn3
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten1
btn3
.
pulseFill
=
true
btn3
.
pulseScale
=
false
btn3
.
setImage
(
img3
,
forState
:
.
Normal
)
btn3
.
setImage
(
img3
,
forState
:
.
Highlighted
)
// Add buttons to right side.
imageCardView
.
rightButtons
=
[
btn1
,
btn2
,
btn3
]
imageCardView
.
rightButtonsInsetsRef
.
top
=
imageCardView
.
contentInsetsRef
.
top
// To support orientation changes, use MaterialLayout.
view
.
addSubview
(
imageCardView
)
imageCardView
.
translatesAutoresizingMaskIntoConstraints
=
false
MaterialLayout
.
alignFromTop
(
view
,
child
:
imageCardView
,
top
:
100
)
MaterialLayout
.
alignToParentHorizontally
(
view
,
child
:
imageCardView
,
left
:
20
,
right
:
20
)
```
### 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