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
418f4090
Unverified
Commit
418f4090
authored
Sep 24, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added PresenterCard sample project and reworked Cards
parent
b701f1b7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
Examples/Programmatic/Card/Card/ViewController.swift
+2
-1
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
+4
-2
Examples/Programmatic/PresenterCard/PresenterCard/ViewController.swift
+15
-5
Sources/iOS/Card.swift
+1
-1
Sources/iOS/PresenterCard.swift
+1
-0
No files found.
Examples/Programmatic/Card/Card/ViewController.swift
View file @
418f4090
...
...
@@ -41,9 +41,9 @@ class ViewController: UIViewController {
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareFavoriteButton
()
prepareToolbar
()
prepareContentView
()
prepareFavoriteButton
()
prepareBottomBar
()
prepareCard
()
}
...
...
@@ -78,6 +78,7 @@ class ViewController: UIViewController {
card
.
toolbar
=
toolbar
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
card
.
cornerRadiusPreset
=
.
cornerRadius1
view
.
layout
(
card
)
.
top
(
100
)
.
left
(
20
)
.
right
(
20
)
}
...
...
Examples/Programmatic/ImageCard/ImageCard/ViewController.swift
View file @
418f4090
...
...
@@ -42,11 +42,11 @@ class ViewController: UIViewController {
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareFavoriteButton
()
prepareBottomBar
()
prepareImageView
()
prepareToolbar
()
prepareContentView
()
prepareFavoriteButton
()
prepareBottomBar
()
prepareImageCard
()
}
...
...
@@ -55,6 +55,7 @@ class ViewController: UIViewController {
imageView
.
image
=
UIImage
(
named
:
"frontier.jpg"
)?
.
resize
(
toWidth
:
view
.
width
)
imageView
.
clipsToBounds
=
true
imageView
.
contentMode
=
.
scaleAspectFill
imageView
.
cornerRadiusPreset
=
.
cornerRadius1
}
private
func
prepareToolbar
()
{
...
...
@@ -98,6 +99,7 @@ class ViewController: UIViewController {
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
card
.
contentEdgeInsetsPreset
=
.
square3
card
.
cornerRadiusPreset
=
.
cornerRadius1
imageView
?
.
layout
(
toolbar
!
)
.
height
(
toolbar
!.
height
+
32
)
view
.
layout
(
card
)
.
top
(
100
)
.
left
(
20
)
.
right
(
20
)
...
...
Examples/Programmatic/PresenterCard/PresenterCard/ViewController.swift
View file @
418f4090
...
...
@@ -45,11 +45,11 @@ class ViewController: UIViewController {
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareImageView
()
prepareToolbar
()
prepareContentView
()
prepareFavoriteButton
()
prepareShareButton
()
prepareStarButton
()
prepareToolbar
()
prepareContentView
()
prepareBottomBar
()
prepareImageCard
()
}
...
...
@@ -59,6 +59,7 @@ class ViewController: UIViewController {
imageView
.
image
=
UIImage
(
named
:
"frontier.jpg"
)?
.
resize
(
toWidth
:
view
.
width
)
imageView
.
clipsToBounds
=
true
imageView
.
contentMode
=
.
scaleAspectFill
imageView
.
cornerRadiusPreset
=
.
cornerRadius1
}
private
func
prepareToolbar
()
{
...
...
@@ -74,6 +75,13 @@ class ViewController: UIViewController {
toolbar
.
contentEdgeInsetsPreset
=
.
square3
toolbar
.
backgroundColor
=
nil
toolbar
.
rightViews
.
append
(
starButton
)
}
@objc
internal
func
handleButton
(
button
:
UIButton
)
{
print
(
"hello"
)
}
private
func
prepareContentView
()
{
...
...
@@ -97,15 +105,16 @@ class ViewController: UIViewController {
private
func
prepareStarButton
()
{
starButton
=
FlatButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
Color
.
grey
.
base
)
starButton
.
pulse
.
color
=
Color
.
grey
.
base
starButton
.
grid
.
columns
=
4
starButton
.
pulse
.
color
=
Color
.
green
.
base
starButton
.
addTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
// starButton.grid.columns = 4
}
private
func
prepareBottomBar
()
{
bottomBar
=
Bar
()
bottomBar
.
backgroundColor
=
nil
bottomBar
.
contentEdgeInsetsPreset
=
.
square1
bottomBar
.
contentView
.
grid
.
views
=
[
favoriteButton
,
shareButton
,
starButton
]
bottomBar
.
contentView
.
grid
.
views
=
[
favoriteButton
,
shareButton
]
}
private
func
prepareImageCard
()
{
...
...
@@ -115,6 +124,7 @@ class ViewController: UIViewController {
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
card
.
contentEdgeInsetsPreset
=
.
square3
card
.
cornerRadiusPreset
=
.
cornerRadius1
imageView
?
.
layout
(
toolbar
!
)
.
height
(
toolbar
!.
height
+
32
)
view
.
layout
(
card
)
.
top
(
100
)
.
left
(
20
)
.
right
(
20
)
...
...
Sources/iOS/Card.swift
View file @
418f4090
...
...
@@ -174,7 +174,7 @@ open class Card: PulseView {
open
override
func
prepare
()
{
super
.
prepare
()
depthPreset
=
.
depth1
cornerRadiusPreset
=
.
cornerRadius1
pulse
.
animation
=
.
none
}
/**
...
...
Sources/iOS/PresenterCard.swift
View file @
418f4090
...
...
@@ -97,6 +97,7 @@ open class PresenterCard: Card {
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
presenterView
?
.
zPosition
=
0
toolbar
?
.
zPosition
=
1000
visualLayer
.
zPosition
=
1
contentView
?
.
zPosition
=
2
bottomBar
?
.
zPosition
=
2
...
...
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