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
a5321c6a
Commit
a5321c6a
authored
Sep 11, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail height is fully dynamic
parent
88cf9092
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
Source/BasicCardView.swift
+8
-14
Source/ImageCardView.swift
+7
-3
No files found.
Source/BasicCardView.swift
View file @
a5321c6a
...
...
@@ -208,15 +208,6 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
}
/**
:name: maximumImageViewHeight
*/
public
var
maximumImageViewHeight
:
CGFloat
=
200
{
didSet
{
prepareCard
()
}
}
/**
:name: maximumTitleLabelHeight
*/
public
var
maximumTitleLabelHeight
:
CGFloat
=
0
{
...
...
@@ -262,7 +253,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
/**
:name: maximumDetailLabelHeight
*/
public
var
maximumDetailLabelHeight
:
CGFloat
=
144
{
public
var
maximumDetailLabelHeight
:
CGFloat
=
0
{
didSet
{
prepareCard
()
}
...
...
@@ -443,10 +434,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
layoutConstraints
+=
Layout
.
constraint
(
"H:|[detailLabelContainer]|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"detailLabelContainer"
:
detailLabelContainer
!
])
verticalFormat
+=
"[detailLabelContainer]"
views
[
"detailLabelContainer"
]
=
detailLabelContainer
!
// text
Layout
.
expandToParentHorizontallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
left
:
detailLabelLeftInset
,
right
:
detailLabelRightInset
)
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|"
,
options
:
nil
,
metrics
:
[
"detailLabelTopInset"
:
detailLabelTopInset
,
"detailLabelBottomInset"
:
detailLabelBottomInset
,
"maximumDetailLabelHeight"
:
maximumDetailLabelHeight
],
views
:
[
"detailLabel"
:
detailLabel
!
]))
if
0
==
maximumDetailLabelHeight
{
Layout
.
expandToParentWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
top
:
detailLabelTopInset
,
left
:
detailLabelLeftInset
,
bottom
:
detailLabelBottomInset
,
right
:
detailLabelRightInset
)
}
else
{
Layout
.
expandToParentHorizontallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
left
:
detailLabelLeftInset
,
right
:
detailLabelRightInset
)
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|"
,
options
:
nil
,
metrics
:
[
"detailLabelTopInset"
:
detailLabelTopInset
,
"detailLabelBottomInset"
:
detailLabelBottomInset
,
"maximumDetailLabelHeight"
:
maximumDetailLabelHeight
],
views
:
[
"detailLabel"
:
detailLabel
!
]))
}
}
// buttons
...
...
Source/ImageCardView.swift
View file @
a5321c6a
...
...
@@ -363,7 +363,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
/**
:name: maximumDetailLabelHeight
*/
public
var
maximumDetailLabelHeight
:
CGFloat
=
144
{
public
var
maximumDetailLabelHeight
:
CGFloat
=
0
{
didSet
{
prepareCard
()
}
...
...
@@ -568,8 +568,12 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
views
[
"detailLabelContainer"
]
=
detailLabelContainer
!
// text
Layout
.
expandToParentHorizontallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
left
:
detailLabelLeftInset
,
right
:
detailLabelRightInset
)
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|"
,
options
:
nil
,
metrics
:
[
"detailLabelTopInset"
:
detailLabelTopInset
,
"detailLabelBottomInset"
:
detailLabelBottomInset
,
"maximumDetailLabelHeight"
:
maximumDetailLabelHeight
],
views
:
[
"detailLabel"
:
detailLabel
!
]))
if
0
==
maximumDetailLabelHeight
{
Layout
.
expandToParentWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
top
:
detailLabelTopInset
,
left
:
detailLabelLeftInset
,
bottom
:
detailLabelBottomInset
,
right
:
detailLabelRightInset
)
}
else
{
Layout
.
expandToParentHorizontallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
left
:
detailLabelLeftInset
,
right
:
detailLabelRightInset
)
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|"
,
options
:
nil
,
metrics
:
[
"detailLabelTopInset"
:
detailLabelTopInset
,
"detailLabelBottomInset"
:
detailLabelBottomInset
,
"maximumDetailLabelHeight"
:
maximumDetailLabelHeight
],
views
:
[
"detailLabel"
:
detailLabel
!
]))
}
}
// buttons
...
...
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