Commit a5321c6a by Daniel Dahan

detail height is fully dynamic

parent 88cf9092
...@@ -208,15 +208,6 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -208,15 +208,6 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
} }
/** /**
:name: maximumImageViewHeight
*/
public var maximumImageViewHeight: CGFloat = 200 {
didSet {
prepareCard()
}
}
/**
:name: maximumTitleLabelHeight :name: maximumTitleLabelHeight
*/ */
public var maximumTitleLabelHeight: CGFloat = 0 { public var maximumTitleLabelHeight: CGFloat = 0 {
...@@ -262,7 +253,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -262,7 +253,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
/** /**
:name: maximumDetailLabelHeight :name: maximumDetailLabelHeight
*/ */
public var maximumDetailLabelHeight: CGFloat = 144 { public var maximumDetailLabelHeight: CGFloat = 0 {
didSet { didSet {
prepareCard() prepareCard()
} }
...@@ -443,10 +434,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -443,10 +434,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
layoutConstraints += Layout.constraint("H:|[detailLabelContainer]|", options: nil, metrics: nil, views: ["detailLabelContainer": detailLabelContainer!]) layoutConstraints += Layout.constraint("H:|[detailLabelContainer]|", options: nil, metrics: nil, views: ["detailLabelContainer": detailLabelContainer!])
verticalFormat += "[detailLabelContainer]" verticalFormat += "[detailLabelContainer]"
views["detailLabelContainer"] = detailLabelContainer! views["detailLabelContainer"] = detailLabelContainer!
// text if 0 == maximumDetailLabelHeight {
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: detailLabelLeftInset, right: detailLabelRightInset) Layout.expandToParentWithPad(detailLabelContainer!, child: detailLabel!, top: detailLabelTopInset, left: detailLabelLeftInset, bottom: detailLabelBottomInset, right: detailLabelRightInset)
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|", options: nil, metrics: ["detailLabelTopInset": detailLabelTopInset, "detailLabelBottomInset": detailLabelBottomInset, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!])) } 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 // buttons
......
...@@ -363,7 +363,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable { ...@@ -363,7 +363,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
/** /**
:name: maximumDetailLabelHeight :name: maximumDetailLabelHeight
*/ */
public var maximumDetailLabelHeight: CGFloat = 144 { public var maximumDetailLabelHeight: CGFloat = 0 {
didSet { didSet {
prepareCard() prepareCard()
} }
...@@ -568,8 +568,12 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable { ...@@ -568,8 +568,12 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
views["detailLabelContainer"] = detailLabelContainer! views["detailLabelContainer"] = detailLabelContainer!
// text // text
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: detailLabelLeftInset, right: detailLabelRightInset) if 0 == maximumDetailLabelHeight {
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|", options: nil, metrics: ["detailLabelTopInset": detailLabelTopInset, "detailLabelBottomInset": detailLabelBottomInset, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!])) 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 // buttons
......
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