gontovnik/DGElasticPullToRefresh

UITableView unable to receive first tap after pull-down-refresh

tqtifnypmb opened this issue · 4 comments

After refresh, UITableView's func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) isn't triggered by first tap.

I just tested it, it appears on iPhone, but not appears on simulator. On iPhone, tableView's didSelect function isn't called by first tap, but I don't know how to fix it now.

I think I have fixed it, I reviewed earlier version, found the version that have dg_stopScrollingAnimation function doesn't appear this issue. But this function was deprecated because of this issue(deshttps://github.com//issues/1). Then I modify the function as this:
func dg_stopScrollingAnimation() {
if let superview = self.superview, let index = superview.subviews.indexOf({ $0 == self }) as Int! {
let tempConstraints = superview.constraints
removeFromSuperview()
superview.insertSubview(self, atIndex: index)
for constraint in tempConstraints {
guard !superview.constraints.contains(constraint) else { continue }
superview.addConstraint(constraint)
}
}
}
Now it works well for me.

That works. But it introduces new issue as " I can interaction with UITableView when it's refreshing". My workaround is this: Just invoke dg_stopScrollingAnimation function inside dg_stopLoading and remove all other invocation.

Now it works for me.
BTW, I can reproduce this issue even on simulator

Thanks @tqtifnypmb & @LvJianting
share my code in swift 4.1

public func dg_stopLoading() {
pullToRefreshView?.stopLoading()
// Added later
dg_stopScrollingAnimation()
}
// Added later
func dg_stopScrollingAnimation() {
// 原先的代码
//if let superview = self.superview, let index = superview.subviews.indexOf({ $0 == self }) as Int! {
if let superview = self.superview, let index = superview.subviews.index(of: self) as Int? {
let tempConstraints = superview.constraints
removeFromSuperview()
superview.insertSubview(self, at: index)
for constraint in tempConstraints {
guard !superview.constraints.contains(constraint) else { continue }
superview.addConstraint(constraint)
}
}
}