I'm working on expandable table cell, and my algorithm is follow:
- I create two views.
- Create the height constraint of second view, drag it as IBOutlet to my cell.
- When cell is selected change status of selected cell.
class ExpandableCell: UITableViewCell {
@IBOutlet weak var expandableCellHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var expandableView: UIView!
var isExpanded:Bool = false
{
didSet
{
if !isExpanded {
self.expandableCellHeightConstraint.constant = 0.0
} else {
self.expandableCellHeightConstraint.constant = 120
}
}
}
}
Everything is fine, but I want my second view resize related to inner content.
Here are my constraints:
So, my question is:
What is the best way to write non-strict value to self.expandableCellHeightConstraint.constant
? Actually I thought of writing something like self.expandableCellHeightConstraint.constant >= 120
, but as far as I get it is impossible.