Commit d24172ff by Daniel Dahan

development: added shadow check

parent 143c0f39
......@@ -45,6 +45,15 @@ public class BasicCard : MaterialCard {
public private(set) var titleLabelContainer: UIView?
/**
:name: shadow
*/
public var shadow: Bool = true {
didSet {
false == shadow ? removeShadow() : prepareShadow()
}
}
/**
:name: titleLabel
*/
public var titleLabel: UILabel? {
......@@ -175,7 +184,7 @@ public class BasicCard : MaterialCard {
// text
titleLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!]))
titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!]))
titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize], views: ["titleLabel": titleLabel!]))
}
// detail
......
......@@ -55,6 +55,13 @@ public struct Layout {
}
/**
:name: expandToParentHorizontally
*/
public static func expandToParentHorizontally(parent: UIView, child: UIView) {
expandToParentHorizontallyWithPad(parent, child: child, left: 0, right: 0)
}
/**
:name: expandToParentHorizontallyWithPad
*/
public static func expandToParentHorizontallyWithPad(parent: UIView, child: UIView, left: CGFloat = 0, right: CGFloat = 0) {
......@@ -62,6 +69,13 @@ public struct Layout {
}
/**
:name: expandToParentVertically
*/
public static func expandToParentVertically(parent: UIView, child: UIView) {
expandToParentVerticallyWithPad(parent, child: child, top: 0, bottom: 0)
}
/**
:name: expandToParentVerticallyWithPad
*/
public static func expandToParentVerticallyWithPad(parent: UIView, child: UIView, top: CGFloat = 0, bottom: CGFloat = 0) {
......
......@@ -120,6 +120,16 @@ public class MaterialCard : UIView {
}
//
// :name: removeShadow
//
internal func removeShadow() {
layer.shadowColor = MaterialTheme.clear.color.CGColor
layer.shadowOffset = CGSizeMake(0, 0)
layer.shadowOpacity = 0
layer.shadowRadius = 0
}
//
// :name: layoutSubviews
//
public override func layoutSubviews() {
......
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