Above is my UITableView. I want when pressing the right(Down arrow) button then my particular UITableViewCell looks like the below image.
But problem is that when I pressing the right(Down arrow) button I am getting a warning like below.
2020-09-18 12:00:15.107030+0530 ET WIFI[1789:44926] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x600002c21950 UIView:0x7fa558d3b040.height == 200 (active)>", "<NSLayoutConstraint:0x600002c21c20 V:[UIView:0x7fa558d3b040]-(5)-| (active, names: '|':UITableViewCellContentView:0x7fa558d386c0 )>", "<NSLayoutConstraint:0x600002c21c70 V:|-(5)-[UIView:0x7fa558d3b040] (active, names: '|':UITableViewCellContentView:0x7fa558d386c0 )>", "<NSLayoutConstraint:0x600002c22030 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fa558d386c0.height == 115 (active)>" )
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600002c21950 UIView:0x7fa558d3b040.height == 200 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. Below is my UITableViewCell class.
class RoomTableViewCell: UITableViewCell {
@IBOutlet weak var roomIcon: UIImageView!
@IBOutlet weak var roomNameLabel: UILabel!
@IBOutlet weak var toggleButton: UIButton!
@IBOutlet var viewHeight: NSLayoutConstraint!
var viewController:HomeViewController?
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
func initializeViewController(myViewController:HomeViewController) {
self.viewController = myViewController
}
@IBAction func toggleButtonPressed(_ sender: UIButton) {
if toggleButton.image(for: .normal) == UIImage(named: "ArrowDownImage") {
toggleButton.setImage(UIImage(named: "ArrowUpImage"), for: .normal)
self.viewHeight.constant = 100
self.viewController?.roomTableView.reloadData()
} else {
toggleButton.setImage(UIImage(named: "ArrowDownImage"), for: .normal)
self.viewHeight.constant = 200
self.viewController?.roomTableView.reloadData()
}
}
}
Now it's working fine, but problem is that when I press the right button then I am getting above warning message in the console. Can you please help me to solve this?