1
我有8個標籤(我們稱之爲a-h),它們應該位於彼此之下。除了其他約束,我做到這一點與:xcode中位置錯位的標籤/錯誤的位置約束條件
a) top space to superview (3)
a) bottom space to b (22)
b) top space to a (22)
b) bottom space to c (22)
等等...
標籤被在Y軸定位22彼此分開。
這隻能然而,如果
c) bottom space to d (-22) !!!
d) top space to c (-22) !!!
所以,因某種原因自動版式似乎要放置標籤d上完全錯誤的位置和我有約束設置來調整到-22代替22.我不明白爲什麼。
我的其他約束爲標籤總是:
- align center y to (the input element next to it)
- leading space to superview
下一步每個標籤我總是成立的輸入元件(的UITextField或UISwitch),其總是具有以下約束條件:
- trailing space to superview
- width
- height
- align center y to (their respective label)
這裏可能發生了什麼?謝謝:) 注意:如果用-22而不是22來調整錯誤的位置,一切看起來都很完美 - 我只是被-22所困擾。
編輯:8行中的2個都將UISwitch作爲標籤旁邊的輸入元素。無論UISwitch唯一有Trailing space to superview
和align center y to (corresponding label)
約束