-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question - Best way to slide the menu back when beginning the touch on the buttons #18
Comments
Hi @FramusRock . Not sure if I understand the issue. Do you mean implementing a way to set the cells to the default position (no button items revealed) when you tap onto another cell?. If so, I guess one way is to implement the willSelectRowAtIndexPath tableview's delegate to dismiss all visible cells. Or maybe the class can be enhanced to provide a custom delegate for that (?). |
Sorry, I maybe wasn't clear enough. Let's say we have three buttons behind the cell on the right side. Now the user slides the cell to reveal the buttons. Now he wants to "close" the cell again by swiping in the other direction without doing anything. My issue here is that the closing swipe/drag can only be origined from the cell itself (so from the little part of it that might be still visible). I'm searching for a way that allows the swipe/drag gestures also to be started from one of the (three) buttons. |
Oh, I see. I haven't thought on that. Currently, the pan gesture recognizer is added to the cell's 'contentView' view. This is why the recognizer is only available on that portion of the cell. So maybe we can experiment by adding the recognizer to the view that holds the buttons or even to the entire cell. Not sure if this would break something. By the way, how does the mail app behave?, does it allow you to swipe/drag the cell the way you describe? Please try this: on the _initSubviews method replace this
by this
Does that do what you want? thanks |
Ah okay it works like that, I was scared it wouldn't be as easy as this. But that works like a charm, thank you!! That was a really easy and cool fix ;) Apple Mail behaves like your cells do by default. I've just got a rather small cell with three buttons behind it, so the space where the user might start touching is quite small. |
Anyway I liked your proposal. I guess in our case we can make it an initialization option, so its easier for developers to chose what suits them best. |
Cool, I'm glad you like it! |
After a big more testing I think we'll need to add the recognizer (or another recognizer) to the view that holds the buttons. The problem I'm facing right now is that the user can no longer efficiently reorder TableViewCells with this setup. The PanGestureRecognizer always wants to be the first to be fired, so the cells will nearly always slide to the side (even if just a tiny bit) instead of letting it being reordered. So even if the user touches the three vertical bars for reordering, so he absolutely wants to reorder he can't in 80% + of the tries I made. I tried to enable simulatenous gesture recognizers but also that does not help here. |
I tried adding an additional gestureRecognizer to the utilityContentView once the reveal menu is fully revelaed and removing it again once the menu is not visible. This leads to a better result but it's still not perfect. Just adding the recognizer to the utilityContentView (w/o removing it again on disappear) still leads to messy reordering. Did I add the recognizer to the wrong view? Do you have an idea how to do this better? Thanks |
I tried it a bit more and got it to work, using the utilityContentView for the second gesture recognizer was fine, I just made a stupid mistake before. |
Hey,
It's me again, this time with a question: What do you think is the best (and easiest) way to be able to slide the reveal menu back on the revealed buttons?
The first idea that came to my mind was to add a GestureRecognizer with the exact same functionality as on the TableViewCell to the revealed buttons.
Is there an easier way than this?
I hope you have some time answer ;)
Best,
Max
The text was updated successfully, but these errors were encountered: