Masonry icon indicating copy to clipboard operation
Masonry copied to clipboard

Initial setup constraints code shouldn't be written in "updateConstraints" method

Open Huanhoo opened this issue 6 years ago • 1 comments

Hi,

According to the Apple Developer Document

In general, you can make these changes at any time. Ideally, most constraints should be set up in Interface Builder, or programatically created by the view controller during the controller’s initial setup (for example, in viewDidLoad). If you need to dynamically change constraints at runtime, it’s usually best to change them when the application’s state changes. For example, if you want to change a constraint in response to a button tap, make that change directly in the button’s action method.

Apple's recommended most constraints should be set up in Interface Builder or during the controller’s initial setup (for example, in viewDidLoad).

But you suggest writing the "adding" code in the updateConstraints method which will add (include initial setup constraints) constraints to UIView

image

So there should be modified?

Huanhoo avatar Apr 17 '19 10:04 Huanhoo

1111

:octocat: From gitme iOS

SilenceZhou avatar Apr 17 '19 12:04 SilenceZhou