我在iOS8上有自動佈局的問題,我可以重新創建的最簡單的情況是一個簡單的tableView。我設置了一個靜態單元,然後只需添加一個標籤。添加披露指標時ios8單元約束破解
我的目標是讓標籤在很大程度上填補了空間,所以我必須在標籤上三個約束...
- 中心垂直它在上海華內(我認爲這是好的)
- 套裝標籤後緣30(相對於上海華)
- 設置標籤導致保證金30(相對於上海華)
這一切都絕對沒問題,並沒有什麼大的問題或工作完美警告(它會警告零高度,但我不認爲這是太多的問題)
現在...如果我添加一個披露指標,它全部崩潰。它仍然看起來不錯,但我得到以下幾點:
2014-10-30 15:51:46.358 ContraintIssue[25572:1586028] 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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand,
refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7fd3f3d23390 UITableViewCellContentView:0x7fd3f3d226f0.trailingMargin == UILabel:0x7fd3f3d227e0'Label'.trailing + 30>",
"<NSLayoutConstraint:0x7fd3f3d235f0 UILabel:0x7fd3f3d227e0'Label'.leading == UITableViewCellContentView:0x7fd3f3d226f0.leadingMargin + 30>",
"<NSLayoutConstraint:0x7fd3f53b73b0 'fittingSizeHTarget' H:[UITableViewCellContentView:0x7fd3f3d226f0(38)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fd3f3d23390 UITableViewCellContentView:0x7fd3f3d226f0.trailingMargin == UILabel:0x7fd3f3d227e0'Label'.trailing + 30>
我不明白,爲什麼添加的指標會導致這樣的問題,這是沒有任何關係的數字規模,我已經試驗相當位。
任何想法?
真實世界的例子是一個單元,它有一個標籤(標籤),然後是另一個標籤或一個文本視圖,其中包含一個值,可以按照本發明進行設置。所以第一個標籤是一個固定大小,理想的第二個標籤需要是它的最大值,但如果需要的話截斷文本。
(見「鈴聲」或「震動設置」中增加了對我想要實現一個例子的接觸)
非常感謝,
利。
我看到了同樣的問題。一切似乎都很好,但警告就在那裏。如果我刪除披露指標,一切正常。有這個運氣嗎? – DemonGyro 2015-01-05 22:15:46
我有這個相同的問題,雖然我無法使用故事板來解決這個問題,但通過在代碼中定義我的UITableViewCell子類的佈局約束,我可以得到accessoryType的工作! – 2015-01-23 01:21:25