Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

ViewDeck with MT.Dialog - how to prevent touch from bubbling

DaveTDaveT DEMember

I'm currently playing around with the Monotouch port of the Inferis ViewDeck (https://github.com/sgmunn/MonoKit) since this is quite a neat control. In my center view I have a DialogViewController which supports editing. And here is the tricky part:
When I'm trying to swipe an element of the dvc to edit/delete it, the swipe is not recognized by the dvc cell but bubbles through to the viewdeck controller and I'm swiping to the left (or right) view of the ViewDeck instead of seeing the cell in edit mode.

Since the dvc does not to prevent this touch from bubbling it seems I have to do this manually... or did I miss something here?

Posts

  • ShaneMunnShaneMunn AUBeta ✭✭

    Hi Dave,

    I ported the ViewDeck component, if you want to send me a sample or post it I'll take a look at it for you. I might take a few days as we're right in the middle of packing up to head off to NZ. I'm also in the middle of a restructure of MonoKit so that you can use ViewDeck standalone from the rest of my library.

    Cheers,
    Greg

  • DaveTDaveT DEMember

    Hi Greg,

    thanks for your offer to help me. I created a little repro for my described scenario. It's basically a merger from one of your ViewDeck samples and a MT.D Advanced Editing sample. The centerview should contain the table from the DVC with a simple swipe to delete functionality whilst the left and right views should be openable by swiping anywhere but an element of the MT.D...

    After building this I stumbled upon a possible reason: when I'm pushing the DVC onto the NavigationController the editing works fine (but of course the ViewDeck is no longer there).
    But when I'm adding the DVC as a ChildViewController and add the TableView as a SubView (to the CenterView) the ViewDeck works fine, but the editing is extremly difficult to catch (it works, but in 1 of 100 cases)

    So, either I'm doing something wrong in adding the DVC to the CenterView, or the events are not correctly handled when the DVC is "just" a subview of the ViewDeck CenterView and the ViewDeck takes all events.

    Hopefully, I didn't get something totally wrong here.

    PS.: I seriously had to laugh seeing your profile pic in addition to mine :)

  • NicWiseNicWise NZMember, Insider, Beta mod

    The viewdeck uses Guestures to do the panning (no other way really), which get in before the table cell can do it's editing.

    I think your options might be:

    Remove the gestures you dont want

    Add an edit button and do editing that way.

  • ShaneMunnShaneMunn AUBeta ✭✭

    Dave, Nic is right - ViewDeck does use a panner to handle swiping from side to side. You can turn off panning if you need to enable the standard edit gesture in your tableview, but you'll need to provide a way for the user to make the left or right controllers visible.

    Some apps do this with a button on the left of the center controller and you can enable the panning while the left or right controllers are visible and turn it off again when they are not.

    Use the PanningMode to control the panning gesture of the ViewDeck, NoPanning will disable it altogether.

    Cheers.

Sign In or Register to comment.