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
42b26c64
Unverified
Commit
42b26c64
authored
Sep 12, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updating for GM 8 preparation
parent
068676f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletions
+53
-1
Sources/iOS/ContentCard.swift
+53
-1
No files found.
Sources/iOS/ContentCard.swift
View file @
42b26c64
...
...
@@ -33,7 +33,7 @@ import UIKit
open
class
ContentCard
:
PulseView
{
/// Will render the view.
open
var
willLayout
:
Bool
{
return
0
<
width
&&
0
<
height
&&
nil
!=
superview
return
0
<
width
&&
nil
!=
superview
}
/// A preset wrapper around contentInset.
...
...
@@ -87,21 +87,33 @@ open class ContentCard: PulseView {
/// A reference to the titleToolbar.
open
var
titleToolbar
:
Toolbar
{
prepareTitleToolbar
()
layoutSubviews
()
return
internalTitleToolbar
!
}
/// A reference to the contentView.
open
var
contentView
:
UIView
{
prepareContentView
()
layoutSubviews
()
return
internalContentView
!
}
/// A reference to the detailToolbar.
open
var
detailToolbar
:
Toolbar
{
prepareDetailToolbar
()
layoutSubviews
()
return
internalDetailToolbar
!
}
/// Grid cell factor.
@IBInspectable
open
var
gridFactor
:
CGFloat
=
24
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
}
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
...
...
@@ -144,6 +156,46 @@ open class ContentCard: PulseView {
}
height
=
h
let
l
=
nil
==
internalTitleToolbar
?
0
:
interimSpace
let
r
=
nil
==
internalDetailToolbar
||
nil
==
internalContentView
?
0
:
interimSpace
let
p
=
h
-
l
-
r
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
let
rows
=
Int
(
p
/
gridFactor
)
grid
.
begin
()
grid
.
views
.
removeAll
()
grid
.
axis
.
rows
=
rows
grid
.
axis
.
direction
=
.
vertical
print
(
"Value"
,
height
,
rows
)
if
let
v
=
internalTitleToolbar
{
grid
.
views
.
append
(
v
)
v
.
grid
.
rows
=
Int
(
ceil
(
v
.
height
/
gridFactor
))
+
1
}
if
let
v
=
internalContentView
{
grid
.
views
.
append
(
v
)
}
if
let
v
=
internalDetailToolbar
{
grid
.
views
.
append
(
v
)
v
.
grid
.
rows
=
Int
(
ceil
(
v
.
height
/
gridFactor
))
+
1
}
if
let
v
=
internalContentView
{
v
.
grid
.
rows
=
rows
if
let
t
=
internalTitleToolbar
{
v
.
grid
.
rows
-=
t
.
grid
.
rows
}
if
let
d
=
internalDetailToolbar
{
v
.
grid
.
rows
-=
d
.
grid
.
rows
}
}
grid
.
commit
()
}
/// Prepares the titleToolbar.
...
...
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