I'm using auto layout for my tableView and for every cell in it, I create some constraints programmatically.
In order to avoid to delete ALL the constraints every time, I would like to know if there is a way to loop view.constraints()
and if there is a constraint such as H:|-view-|
, I delete it.
Is it possible?
You would need to use variables (or an array) to hold those constraints that match what you want and then loop the view.constraints() to remove them. When you use the visual format, whatever you create is converted into multiple constraints.
Another method to use is to go through the constraints and check the constraint properties such as firstItem and secondItem, relation, etc. to match what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With