1
我有奇怪的行为。我的整个视图控制器看起来像这样(垂直排列):使用Autolay动画动画UIView UITableView的复选标记
- 的UILabel,
- 的UITableView,
- 的UIView(在需要时将在&滑出)。 [见PS]
我的UIView和底部布局引导之间添加约束,我用这种方法制作动画:
func toggleContinueButton(_ toggleOn: Bool) {
if toggleOn {
self.buttonViewConstraint.constant = 0
} else {
self.buttonViewConstraint.constant = -80
}
UIView.animate(withDuration: 0.5) {
self.view.layoutIfNeeded()
}
}
出于某种奇怪的原因,这个螺丝对号,也就是现在的“飞”从屏幕左边缘的外侧,右侧移动到选定单元格右侧的正确位置和预期位置。下面我有选择/取消选择的简单代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.cellForRow(at: indexPath)!.accessoryType = .checkmark
self.updateContinueButtonState()
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
tableView.cellForRow(at: indexPath)!.accessoryType = .none
self.updateContinueButtonState()
}
有没有人遇到过这样的怪诞?
p.s.尝试了两个版本:第一,滑动UIView是在&徘徊在tableView的顶部,第二,在UIView滑动缩小tableView的高度。没有工作。