scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.6k stars 510 forks source link

UITableView's didSelectRowAt not called after swiping #164

Closed peterstojanowski closed 5 years ago

peterstojanowski commented 5 years ago

Short description

There is a really annoying bug when the contentViewController of the FloatingPanelController has a UITableView. When you swipe up or down quickly so that the floating panel bounces a bit at the end of animation, the first tap on UITableView cell is ignored - the delegate method tableView:didSelectRowAt: is not called. It's being called the second time you tap on a cell or when you swipe slowly and then tap. There must be an issue with intercepting some gestures when UIScrollView decelerates but I didn't have much time to investigate properly.

Expected behavior

The tableView:didSelectRowAt: is called every time.

Actual behavior

The tableView:didSelectRowAt: is not called the first time after scrolling quickly.

Steps to reproduce

Can be easily reproduced using the Maps example by adding some logs to tableView:didSelectRowAt: to see they are not printed out after scrolling fast and tapping on a cell.

Code example that reproduces the issue

Environment

Library version 1.4.0 Installation method

iOS version(s) 12 Xcode version 10.1

RpX974 commented 5 years ago

Hi, I have the same issue. Did you find a solution ?

scenee commented 5 years ago

I acknowledged this issue. I will try to fix it.

scenee commented 5 years ago

How about fix-tap-abort branch(7a51219)?

peterstojanowski commented 5 years ago

Yes, this fixes the issue. Thanks.

RpX974 commented 5 years ago

Still same for me :/

peterstojanowski commented 5 years ago

I double checked that on the Maps example and looks like it's only partially fixed. It works now when you swipe up from tip to half and half to full but it's still broken when you swipe from full to half. @RpX974 can you confirm that?

RpX974 commented 5 years ago

I'm using from tip to full, so I can confirm for that. I will try the other ways.

RpX974 commented 5 years ago

Yes, from tip to half, it works

RpX974 commented 5 years ago

Nevermind, it doesn't work too, I scrolled before when I tried from tip to half.

RpX974 commented 5 years ago

Ok, I found something. When I try to change the height constraint of a view in "floatingPanelDidChangePosition" for the tip position, I got the issue. But if I don't change the height, I don't have the issue.

scenee commented 5 years ago

This issue might be related to this bug ,https://bugs.swift.org/browse/SR-10257. See also here, https://stackoverflow.com/questions/55592341/xcode-10-2-protocol-inheritance-issue.

peterstojanowski commented 5 years ago

@SCENEE I doubt that. This issue can be reproduced using Xcode 10.1. The bugs you're talking about are related to Xcode 10.2.

scenee commented 5 years ago

Thanks for your quick feedback, @peterstojanowski 😀 I struggled with this issue for a while and at last I found a solution to make it better! I know it doesn't defeat this issue completely, but eases the problem. I pushed 9076ba8 commit. I'm pleased to check it out 👍

scenee commented 5 years ago

Hmm.... the commit is still only partially fixed...

congmn commented 5 years ago

I found out that Apple Maps has the same bug on the latest version (iOS 12.2)

scenee commented 5 years ago

Thanks for your sharing, @congmn! Then I think it's hard to fix this issue completely without modifying a tap gesture handling of UITableView. So I'm going to merge #185 to master.

ThangTruong921 commented 5 years ago

I have a suggestion to solve this problem. You can put the button into the cells of the table. I succeeded with this solution.

scenee commented 5 years ago

I merged a solution into master to ease this issue 👍 Thanks all 🎉 I closed this issue for now, but I would like to fix it as expected so welcome any ideas and mentions for this :relieved:.