我試圖展開/摺疊在UIViewController
內的UITableView
。我把UITableView
高度約束到零,使動畫收起展開UITableView
func collapseExpandRoomSection() {
isRoomCollapsed = !isRoomCollapsed
tableHeightConstraint.constant = isRoomCollapsed ? 0.0 : totalTableHeight
UIView.animateWithDuration(0.3) {
self.view.layoutIfNeeded()
}
}
崩潰影響工作正常,但是當我試圖擴大表中的所有細胞都不見了。
感謝
粘貼代碼展開在這裏.. –
我猜你的'totalTableHeight'沒有正確設置。你有沒有在你的'collapseExpandRoomSection()'方法中檢查它是否爲0?試着用像50.0這樣的常量值臨時替換'totalTableHeight',看看是否有效。 – Mischa