Commit 1d287d03 by Daniel Dahan

development: update issue when setting containers to nil in cards

parent ef06acfd
...@@ -245,6 +245,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -245,6 +245,7 @@ public class BasicCardView : MaterialCardView, Comparable {
t.textColor = MaterialTheme.white.color t.textColor = MaterialTheme.white.color
} else { } else {
titleLabelContainer?.removeFromSuperview() titleLabelContainer?.removeFromSuperview()
titleLabelContainer = nil
} }
prepareCard() prepareCard()
} }
...@@ -288,6 +289,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -288,6 +289,7 @@ public class BasicCardView : MaterialCardView, Comparable {
l.lineBreakMode = .ByTruncatingTail l.lineBreakMode = .ByTruncatingTail
} else { } else {
detailLabelContainer?.removeFromSuperview() detailLabelContainer?.removeFromSuperview()
detailLabelContainer = nil
} }
prepareCard() prepareCard()
} }
...@@ -321,6 +323,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -321,6 +323,7 @@ public class BasicCardView : MaterialCardView, Comparable {
didSet { didSet {
if nil == rightButtons && nil == leftButtons { if nil == rightButtons && nil == leftButtons {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
buttonsContainer = nil
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
...@@ -338,6 +341,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -338,6 +341,7 @@ public class BasicCardView : MaterialCardView, Comparable {
didSet { didSet {
if nil == rightButtons && nil == leftButtons { if nil == rightButtons && nil == leftButtons {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
buttonsContainer = nil
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
......
...@@ -305,6 +305,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -305,6 +305,7 @@ public class ImageCardView : MaterialCardView, Comparable {
} }
} else { } else {
imageViewContainer?.removeFromSuperview() imageViewContainer?.removeFromSuperview()
imageViewContainer = nil
} }
prepareCard() prepareCard()
} }
...@@ -355,6 +356,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -355,6 +356,7 @@ public class ImageCardView : MaterialCardView, Comparable {
} }
} else { } else {
titleLabelContainer?.removeFromSuperview() titleLabelContainer?.removeFromSuperview()
titleLabelContainer = nil
} }
prepareCard() prepareCard()
} }
...@@ -398,6 +400,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -398,6 +400,7 @@ public class ImageCardView : MaterialCardView, Comparable {
l.lineBreakMode = .ByTruncatingTail l.lineBreakMode = .ByTruncatingTail
} else { } else {
detailLabelContainer?.removeFromSuperview() detailLabelContainer?.removeFromSuperview()
detailLabelContainer = nil
} }
prepareCard() prepareCard()
} }
...@@ -431,6 +434,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -431,6 +434,7 @@ public class ImageCardView : MaterialCardView, Comparable {
didSet { didSet {
if nil == rightButtons && nil == leftButtons { if nil == rightButtons && nil == leftButtons {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
buttonsContainer = nil
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
...@@ -448,6 +452,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -448,6 +452,7 @@ public class ImageCardView : MaterialCardView, Comparable {
didSet { didSet {
if nil == rightButtons && nil == leftButtons { if nil == rightButtons && nil == leftButtons {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
buttonsContainer = nil
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
......
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