DGElasticPullToRefresh icon indicating copy to clipboard operation
DGElasticPullToRefresh copied to clipboard

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

Open tqtifnypmb opened this issue 8 years ago • 4 comments

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

tqtifnypmb avatar Jul 18 '16 02:07 tqtifnypmb

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.

LvJianting avatar Jul 18 '16 07:07 LvJianting

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/gontovnik/DGElasticPullToRefresh/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.

LvJianting avatar Jul 18 '16 13:07 LvJianting

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

tqtifnypmb avatar Jul 19 '16 02:07 tqtifnypmb

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) } } }

javaLover2014 avatar Oct 18 '18 01:10 javaLover2014