Commit a9b489a0 by Daniel Dahan

fixed issue where MaterialLayer would break when initializing with an empty layer.

parent 55817cd7
...@@ -548,7 +548,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -548,7 +548,7 @@ public class ImageCardView : MaterialPulseView {
if nil == imageLayer { if nil == imageLayer {
imageLayer = CAShapeLayer() imageLayer = CAShapeLayer()
imageLayer!.masksToBounds = true imageLayer!.masksToBounds = true
imageLayer!.zPosition = -1 imageLayer!.zPosition = 0
visualLayer.addSublayer(imageLayer!) visualLayer.addSublayer(imageLayer!)
} }
} }
......
...@@ -458,7 +458,7 @@ public class MaterialButton : UIButton { ...@@ -458,7 +458,7 @@ public class MaterialButton : UIButton {
// :name: prepareVisualLayer // :name: prepareVisualLayer
// //
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer.zPosition = -1 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
} }
......
...@@ -187,7 +187,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -187,7 +187,7 @@ public class MaterialLayer : CAShapeLayer {
shape = .None shape = .None
shadowDepth = .None shadowDepth = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
prepareLayer() prepareVisualLayer()
} }
/** /**
...@@ -196,8 +196,8 @@ public class MaterialLayer : CAShapeLayer { ...@@ -196,8 +196,8 @@ public class MaterialLayer : CAShapeLayer {
public override init(layer: AnyObject) { public override init(layer: AnyObject) {
shape = .None shape = .None
shadowDepth = .None shadowDepth = .None
super.init(layer: layer) super.init()
prepareLayer() prepareVisualLayer()
} }
/** /**
...@@ -207,7 +207,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -207,7 +207,7 @@ public class MaterialLayer : CAShapeLayer {
shape = .None shape = .None
shadowDepth = .None shadowDepth = .None
super.init() super.init()
prepareLayer() prepareVisualLayer()
} }
/** /**
...@@ -269,12 +269,12 @@ public class MaterialLayer : CAShapeLayer { ...@@ -269,12 +269,12 @@ public class MaterialLayer : CAShapeLayer {
} }
/** /**
:name: prepareLayer :name: prepareVisualLayer
*/ */
public func prepareLayer() { public func prepareVisualLayer() {
// visualLayer // visualLayer
visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
visualLayer.zPosition = -1
addSublayer(visualLayer) addSublayer(visualLayer)
} }
......
...@@ -397,7 +397,7 @@ public class MaterialView : UIView { ...@@ -397,7 +397,7 @@ public class MaterialView : UIView {
// :name: prepareVisualLayer // :name: prepareVisualLayer
// //
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer.zPosition = -1 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
} }
......
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