iOS

Unable to Set Layout Constraint to Zero in Xcode 11.3


If you’ve upgraded to Xcode 11.3 and you use Interface Builder to create the app UI, you may find it impossible to set the value of spacing constraints to zero. Just open Interface Builder and click “Add new constraints” to try it out. After you set one of the constraints to 0, it’ll automatically revert it back to standard.

Unable to Set Layout Constraint to Zero in Xcode 11.3 1

We got a number of emails from our readers asking about the issue. No worries. It’s not your fault, but a bug in Xcode 11.3. And, according to the release note of Xcode 11.4, the bug will soon be fixed:

  • Fixed a bug that prevented entering a 0 constant in the constraint popup editors. (54076090)

Any Workaround?

Meanwhile, the best way to workaround the issue is to set a constraint value larger than 0. And then, go to the Size inspector to change its value back to zero.

Unable to Set Layout Constraint to Zero in Xcode 11.3 2

Alternatively, you may set the constraint value to 0.01.

Tutorial
Displaying Facebook Ads in Your iOS Apps
Swift
Creating Gradient Colors Using CAGradientLayer
Swift
Protocol Oriented Programming in Swift: Is it better than Object Oriented Programming?
Shares