In my updateLayoutConstraints, I am adding constraints, and then I call super.updateLayoutConstraints()
. According to the Apple documentation, this seems OK, however does UIKit remove constraints automatically before calling this function?
I am finding that this works OK but I am concerned that I am just re-adding the same type of constraints.
When does UIKit remove constraints automatically or doesn't it?
No updateConstraints
does not remove any constraints you added. If you want to avoid adding duplicate constraints, you need to set a flag or keep references to the constraints you already created.