如果你已經把 Xcode 升級到 11.3 版本,你會發現當你使用 Interface Builder 創建 App UI 時,無法將間距約束條件 (spacing constraints) 的值設置為零。你可以打開 Interface Builder,然後點擊 “Add new constraints” 來試試看,將其中一個約束條件設置為 0 後,它卻自動將其恢復為 standard。

針對這個問題,我們收到很多讀者的提問。不用擔心!這不是你的錯,而是 Xcode 11.3 的一個 bug。根據 Xcode 11.4 的 release note,這個 bug 很快就會修好了:
- Fixed a bug that prevented entering a 0 constant in the constraint popup editors.(修復了無法在約束條件編輯器中輸入常數 0 的 bug。 )(54076090)
現在有甚麼解決方法呢?
暫時來說,要解決此問題,最佳的方法是將約束條件值設置為一個大於 0 的數值。然後到 Size inspector 將數值更改回 0。

又或者,你也可以將約束條件值設置為 0.01。
譯者簡介:Kelly Chan-AppCoda 編輯小姐。
原文:Unable to Set Layout Constraint to Zero in Xcode 11.3
原文:Unable to Set Layout Constraint to Zero in Xcode 11.3