Commit 391ed843 by Daniel Dahan

development: cards can now be dynamically sized and return a height based on content sizes

parent 59af6439
...@@ -31,11 +31,6 @@ ...@@ -31,11 +31,6 @@
import UIKit import UIKit
open class Card: PulseView { open class Card: PulseView {
/// Will layout the view.
open var willLayout: Bool {
return 0 < width && nil != superview
}
/// A container view for subviews. /// A container view for subviews.
open let container = UIView() open let container = UIView()
...@@ -182,12 +177,7 @@ open class Card: PulseView { ...@@ -182,12 +177,7 @@ open class Card: PulseView {
open override func layoutSubviews() { open override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
guard willLayout else {
return
}
container.width = width container.width = width
reload() reload()
} }
...@@ -235,9 +225,9 @@ open class Card: PulseView { ...@@ -235,9 +225,9 @@ open class Card: PulseView {
*/ */
@discardableResult @discardableResult
open func prepare(view: UIView, with insets: EdgeInsets, from top: CGFloat) -> CGFloat { open func prepare(view: UIView, with insets: EdgeInsets, from top: CGFloat) -> CGFloat {
let t = insets.top + top let y = insets.top + top
view.y = t view.y = y
view.x = insets.left view.x = insets.left
let w = container.width - insets.left - insets.right let w = container.width - insets.left - insets.right
...@@ -251,7 +241,7 @@ open class Card: PulseView { ...@@ -251,7 +241,7 @@ open class Card: PulseView {
view.width = w view.width = w
view.height = h view.height = h
return t + h + insets.bottom return y + h + insets.bottom
} }
/** /**
......
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