Commit a5321c6a by Daniel Dahan

detail height is fully dynamic

parent 88cf9092
......@@ -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()
}
......@@ -444,10 +435,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
verticalFormat += "[detailLabelContainer]"
views["detailLabelContainer"] = detailLabelContainer!
// text
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
if nil != buttonsContainer && (nil != leftButtons || nil != rightButtons) {
......
......@@ -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,9 +568,13 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
views["detailLabelContainer"] = detailLabelContainer!
// text
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
if nil != buttonsContainer && (nil != leftButtons || nil != rightButtons) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment