I'm having trouble changing the relation on a constraint from storyboard. This is how the table view looks like at the moment.
When the more button is click, I want the table view to look like this.
Okay, so I drag the bottom constraint from the imageView into my tableViewCell.swift file and named it imageBottomConstraint. I tried imageBottomConstraint.relation = .greaterThan but gives me an error saying that it's only a get, so the relation is equalTo and I'm trying to change it to greaterThan.
Here is were I'm confused and stuck, so I'm trying to create a new constraint but don't really understand NSLayoutConstraint(item:, attribute:, relatedBy:, toItem:, attribute:, multiplier:, constant:). Don't understand item, attribute, relatedBy, toItem & attribute, can someone please help clarify.
My disaster code I thought would work but nope crashes instead.
@IBAction func showMoreBtn() {
let item = imageBottomConstraint.firstItem
let attribute1 = imageBottomConstraint.firstAttribute
let relatedBy = NSLayoutRelation.greaterThanOrEqual
let item2 = imageBottomConstraint.secondItem
let attribute2 = imageBottomConstraint.secondAttribute
let multiplier = imageBottomConstraint.multiplier
let constant = 12
let newConstraint = NSLayoutConstraint(item: item, attribute: attribute1, relatedBy: relatedBy, toItem: toItem, attribute: attribute2, multiplier: multiplier, constant: 12)
}
So as you can see I don't know what I am doing, when creating constraint programmatic. Would appreciate the help.