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
ca1719c3
Unverified
Commit
ca1719c3
authored
Sep 22, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Card internals
parent
141e5838
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
Examples/Programmatic/Card/Card/ViewController.swift
+1
-1
Sources/iOS/Card.swift
+17
-14
No files found.
Examples/Programmatic/Card/Card/ViewController.swift
View file @
ca1719c3
...
...
@@ -51,6 +51,7 @@ class ViewController: UIViewController {
private
func
prepareTitleBar
()
{
titleBar
=
Toolbar
()
titleBar
.
title
=
"Title"
titleBar
.
detail
=
"Detail Description"
titleBar
.
backgroundColor
=
nil
}
...
...
@@ -75,7 +76,6 @@ class ViewController: UIViewController {
private
func
prepareCard
()
{
let
card
=
Card
()
card
.
pulseAnimation
=
.
pointWithBacking
card
.
titleBar
=
titleBar
card
.
contentView
=
contentView
card
.
bottomBar
=
bottomBar
...
...
Sources/iOS/Card.swift
View file @
ca1719c3
...
...
@@ -43,6 +43,7 @@ open class Card: PulseView {
}
set
(
value
)
{
grid
.
contentEdgeInsetsPreset
=
value
layoutSubviews
()
}
}
...
...
@@ -54,6 +55,7 @@ open class Card: PulseView {
}
set
(
value
)
{
grid
.
contentEdgeInsets
=
value
layoutSubviews
()
}
}
...
...
@@ -72,6 +74,7 @@ open class Card: PulseView {
}
set
(
value
)
{
grid
.
interimSpace
=
value
layoutSubviews
()
}
}
...
...
@@ -143,13 +146,8 @@ open class Card: PulseView {
v
.
removeFromSuperview
()
}
var
format
=
"V:|-(
insetT
op)"
var
format
=
"V:|-(
t
op)"
var
views
=
[
String
:
Any
]()
var
metrics
=
[
String
:
Any
]()
metrics
[
"insetTop"
]
=
contentEdgeInsets
.
top
metrics
[
"insetBottom"
]
=
contentEdgeInsets
.
bottom
metrics
[
"interimSpace"
]
=
interimSpace
if
let
v
=
titleBar
{
format
+=
"-[titleBar]"
...
...
@@ -158,22 +156,27 @@ open class Card: PulseView {
}
if
let
v
=
contentView
{
format
+=
"-(interimSpace)
-[contentView]"
format
+=
(
nil
==
titleBar
?
""
:
"-(interimSpace)"
)
+
"
-[contentView]"
views
[
"contentView"
]
=
v
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
}
if
let
v
=
bottomBar
{
format
+=
"-(interimSpace)
-[bottomBar]"
format
+=
(
nil
==
titleBar
&&
nil
==
contentView
?
""
:
"-(interimSpace)"
)
+
"
-[bottomBar]"
views
[
"bottomBar"
]
=
v
layout
(
v
)
.
horizontally
(
left
:
contentEdgeInsets
.
left
,
right
:
contentEdgeInsets
.
right
)
}
format
+=
"-(insetBottom)-|"
if
0
<
views
.
count
{
addConstraints
(
Layout
.
constraint
(
format
:
format
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
guard
0
<
views
.
count
else
{
return
}
var
metrics
=
[
String
:
Any
]()
metrics
[
"top"
]
=
contentEdgeInsets
.
top
metrics
[
"bottom"
]
=
contentEdgeInsets
.
bottom
metrics
[
"interimSpace"
]
=
interimSpace
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
-(bottom)-|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
}
/**
...
...
@@ -186,10 +189,10 @@ open class Card: PulseView {
open
override
func
prepare
()
{
super
.
prepare
()
depthPreset
=
.
depth1
pulseAnimation
=
.
none
contentEdgeInsetsPreset
=
.
square1
interimSpacePreset
=
.
interimSpace3
contentEdgeInsetsPreset
=
.
wideRectangle3
cornerRadiusPreset
=
.
cornerRadius1
pulseAnimation
=
.
none
}
/**
...
...
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