我有一个UIView
中UITableViewCell
。 我试图改变的高度view
与动画。 下面是我做的:
self.myViewConstraint.constant = 100; // Coming from 0
[UIView animateWithDuration:0.3f animations:^{
[self.view layoutIfNeeded];
}];
唯一的一点是,它是在一个tableView
。 所以在这里我就是这样做的heightForRow...
:
return self.myViewConstraint.constant == 0 ? 74 : 174;
现在我需要更新tableView
,所以我在插入animateWithDuration
:
[self.tableView beginUpdates];
[self.tableView endUpdates];
因为我有里面其他的东西cell
,所以constraints
搞的一团糟,而cells
高度动画。 我怎样才能更新cells
没有得到搞砸限制高度? (我想要的cells
高度动画。)
这里是警告我得到。 (一切正常,但我只是想删除的警告。)
编辑我改变了一点,现在我得到这个错误:
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:0x7f8d62d15670 V:[tagResultTableView:0x7f8d62d901a0(107)]>",
"<NSLayoutConstraint:0x7f8d62cea010 tagResultTableView:0x7f8d62d901a0.top == UITableViewCellContentView:0x7f8d62d8fd50.topMargin - 8>",
"<NSLayoutConstraint:0x7f8d62cf0760 V:[tagResultTableView:0x7f8d62d901a0]-(8)-[UILabel:0x7f8d62d2e2e0'Limit: Up to 5 tags']>",
"<NSLayoutConstraint:0x7f8d62cf0800 UILabel:0x7f8d62d2e2e0'Limit: Up to 5 tags'.bottom == UITableViewCellContentView:0x7f8d62d8fd50.bottomMargin>",
"<NSLayoutConstraint:0x7f8d62f726d0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7f8d62d8fd50(32)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f8d62d15670 V:[tagResultTableView:0x7f8d62d901a0(107)]>