2016-01-08 103 views
-1

我只想將UILabel居中放在我的UITableViewCell中。 我設置了以下限制:UITableViewCell約束問題

  • 尾隨空間:10
  • 領先的空間:10
  • 頂部空間:10

對於一些我收到此錯誤的細胞:

Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "", "", "" )

而標籤似乎是關閉的細胞(細胞是空的)。

這裏是限制什麼樣子:

enter image description here

任何想法?

+0

你設置高度約束的標籤嗎?然後可能請從xib – jay

+0

共享約束的屏幕截圖(全部應該展開)您需要設置高度約束。 – darshan

+1

可以請你分享你的項目或一些代碼? –

回答

2

刪除原來的三個約束,並使用對齊約束在容器對準水平和垂直設置爲0

enter image description here

+0

我試過這個約束,它也不起作用。無論如何,我將需要添加更多的控制單元,所以只集中它是不夠的... – bashan

+0

只是好奇,但當你說它沒有工作Xcode給出了一個錯誤,或沒有它居中UILabel正確嗎? – Harg

+1

「它不起作用」不是一個非常有效的迴應。出了什麼問題,他們不在中心位置,你有錯誤嗎,他們飛出了窗外?無論如何,在你的問題中,你說你「只是想要集中」,現在你說你想要別的東西。它是什麼? – fishinear