Я создал ячейку, имеющую один UIView.Предупреждения консоли Geting «Невозможно одновременно удовлетворить ограничения» при обновлении ячейки UITableView
В -cellForRowAtIndexPath
я звоню в -updateData
селектор, который делают некоторые ярлыки в нем. И когда все ярлыки добавляются я увеличивая ограничение высоты tableViewCell
(я сделал выход высоты Constraint)
Ниже приведены две последние строки моего -updateData
Selector:
self.cellHeightConstraint.constant = yPosition + Padding;
[self layoutIfNeeded];
Редактировать
Вот моя таблица Просмотр конфигурации Autolayout:
self.tableView.estimatedRowHeight = 90;
self.tableView.rowHeight = UITableViewAutomaticDimension;
CellForRowAtIndexPath метод
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCell];
[cell updateDataWithBillDetail:wrapper];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
Когда я запускаю этот код я получаю следующее предупреждение:
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.
(
"<NSLayoutConstraint:0x13d8f9cf0 V:[UIView:0x13d8fb090(114)]>",
"<NSLayoutConstraint:0x13d8fb200 UIView:0x13d8fb090.top == UITableViewCellContentView:0x13d8faf10.topMargin - 8>",
"<NSLayoutConstraint:0x13d8fb250 V:[UIView:0x13d8fb090]-(0)-| (Names: '|':UITableViewCellContentView:0x13d8faf10)>",
"<NSLayoutConstraint:0x13db6cd80 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x13d8faf10(35.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x13d8f9cf0 V:[UIView:0x13d8fb090(114)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Может кто-то помогает мне, как я могу удалить это предупреждение консоли?
Это может быть связанно с 'height' возвращенного' cellForRowAtIndexPath: 'не совпадает с один установленным' высотой constraint' Вы можете поделиться соответствующим кодом – ystack
почему -8 в ваших ограничениях (.. но это другое дело)? просто чтобы проверить это, попробовали ли вы просто дать ячейке ограничение ширины и высоты? – zero3nna
@ zero3nna yes Если я не назову свой метод '-updateData', то никаких предупреждений не будет. – Dalvik