IMPORTANT: My problem is not what I implement instead . Already verified that :) didDeelectRowAt
didSelectRowAt
I have UITableView
one that is displayed on a part of the screen in a modally presented view controller. When the user drags it, it changes to full screen and returns to a certain minimum height. I do this by implementing the following methods from UIScrollViewDelegate
:
func scrollViewDidScroll(_ scrollView: UIScrollView) {
guard !scrollView.isDecelerating else { return }
let contentOffset = scrollView.contentOffset.y
if tableViewHeightConstraint.constant < view.frame.height && contentOffset > 0.0 {
tableViewHeightConstraint.constant = min(contentOffset + tableViewHeightConstraint.constant, view.frame.height)
scrollView.contentOffset.y = 0.0
return
}
if tableViewHeightConstraint.constant > minViewHeight && contentOffset < 0.0 {
tableViewHeightConstraint.constant = max(tableViewHeightConstraint.constant + contentOffset, minViewHeight)
scrollView.contentOffset.y = 0.0
}
}
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
heightConstraint.constant = newConstraintHeight
UIView.animate(withDuration: TimeInterval(calculatedAnimationDuration), delay: 0.0, options: .curveEaseOut, animations: {
self.view.layoutIfNeeded()
}, completion: nil)
}
Everything regarding resizing and scrolling works fine, but there is a problem that I cannot understand why this is happening. This is the following:
- When a view controller with a table view is displayed for the first time with a minimum height, and I click on a cell, it works fine.
- , , .
- , , , , , ,
UIScrollViewDelegate
UITableViewDelegate
, , .
, , , . , didSelectRowAt
.
:
: https://github.com/nikmin/DragTest
, , , -, - , , .
... , , , < 0 , .