我已在我的表视图单元格上应用了longPress手势进行选择(因为这样的要求)。长按任何一个单元格并选择它之后,将出现一个从底部开始的视图,并且tableview自动向上滚动。 同样,当我再次取消选择选定的单元格时,表格视图也会向上滚动。 任何帮助表示赞赏。
func resetSelectedRequests()
{
if arrSelectedIndex.count > 0 {
if arrSelectedIndex.count == filteredRequests?.count {
self.arrSelectedIndex.removeAll()
self.isAllChecked = true
}else {
self.isAllChecked = false
}
if self.actionsViewHeightConstraint.constant == Height.height0.rawValue {
DispatchQueue.main.asyncAfter(deadline: .now() + TimeDelay.decimalTwentyFive.rawValue) {
if arrSelectedIndex.count > 0 {
UIView.animate(withDuration: TimeDelay.decimalOne.rawValue, delay: TimeDelay.zero.rawValue, options: UIViewAnimationOptions.curveEaseIn, animations: {
self.actionsViewHeightConstraint.constant = Height.height60.rawValue
}, completion: nil)
}
}
}
tblViewApproveRequest.reloadData()
tblViewApproveRequest.layoutIfNeeded()
}else {
deselectAllRequests()
}
}