I would like to update constraitn constants and multiplier and I would like to update these constraints in right view controller life cycle event
loadView
viewDidLoad
viewWillAppear
viewWillLayoutSubviews
viewDidLayoutSubviews
viewDidAppear
There are some posts saying its better to update constraints at UpdateViewConstraints method of viewcontroller
There is so much confusion related surrounding this.
Somebody please explain
Create your constraints in your storyboard. Control-drag from your constraints into your source file to create outlets to those constraints.
Then, in your button IBAction method, update the constant values to the constraints and call layoutIfNeeded().
As Paul said in his comment, if you're creating your views in code, also create your constraints in code and save them to properties in your view controller, then use those properties in your button IBAction like described above.
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