Accessing Constraints

Hi

I’m trying to adjust the height of a custom cell programmatically (basically hide/show the iOSDatePicker when I tap a button). Can anyone help me access a Constraint after it is added? Including a Name in the constructors of iOSLayoutConstraint doesn’t;t seem to be an option. If I could name the Constraint when adding, or recall a Constraint without knowing it’s name, I believe I’d manage it.

Thanks and Keep Safe

Chris

Hi Chris,

If you are adding the constraint programmatically, you need to keep a reference to it, in order to re-use it.

If you are adding a constraint in the layout editor, you need to name it to have access to it programmatically.

right
the name basically turns into a method that can be used to get to the constraint itself
the IDE generates code to hang on to the reference for you

Very good! Thanks very much.