Commit c20e6381 by Daniel Dahan

updating ImageCardView to allow dynamic image sizing

parent 95bee682
...@@ -35,12 +35,14 @@ public class ImageCardView : MaterialPulseView { ...@@ -35,12 +35,14 @@ public class ImageCardView : MaterialPulseView {
if let v = value { if let v = value {
imageLayer.contents = v.CGImage imageLayer.contents = v.CGImage
if 0 == imageLayer.frame.size.height { if 0 == imageLayer.frame.size.height {
imageLayer.frame.size.height = 200 imageLayer.frame.size.height = v.size.height
} }
imageLayer.hidden = false
} }
else { else {
imageLayer.contents = nil
imageLayer.frame = CGRectZero imageLayer.frame = CGRectZero
imageLayer.removeFromSuperlayer() imageLayer.hidden = true
} }
reloadView() reloadView()
} }
......
...@@ -143,11 +143,11 @@ public extension MaterialTheme.imageCardView { ...@@ -143,11 +143,11 @@ public extension MaterialTheme.imageCardView {
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .None public static var cornerRadius: MaterialRadius = .None
public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square3) public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var titleLabelInsetsRef: MaterialInsetsType = (top: 0, left: 8, bottom: 0, right: 8) public static var titleLabelInsetsRef: MaterialInsetsType = (top: 8, left: 16, bottom: 0, right: 16)
public static var detailLabelInsetsRef: MaterialInsetsType = (top: 0, left: 8, bottom: 16, right: 8) public static var detailLabelInsetsRef: MaterialInsetsType = (top: 8, left: 16, bottom: 16, right: 16)
public static var leftButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 8, bottom: -8, right: 0) public static var leftButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: 0, right: 0)
public static var rightButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: -8, right: 8) public static var rightButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: 0, right: 0)
// border // border
public static var borderWidth: MaterialBorder = .None public static var borderWidth: MaterialBorder = .None
......
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