Swipe for Delete and "More" - iOS 7 EMail App like

Hello,

I like how you can swipe to the left on the iOS Email App to either delete or access other options for an email.
I would like to do this in my app, but so far all I have found is this:

http://stackoverflow.com/questions/17254402/swipe-to-delete-and-the-more-button-like-in-mail-app-on-ios-7

I tried overriding the WillTransitionToState but it only tells me if the Delete button is being shown.
How do I access the view containing the Delete button so I can add another one there?

Is this a bad idea?
I would gladly take any recommendations or alternatives.

Thanks!
R.

Posts

  • DannyCDannyC US ✭✭✭✭

    @rrodriguez there is an Objective-C version on Github: https://github.com/CEWendel/SWTableViewCell Wish I had more time to port it over to Xamarin.iOS but your welcome to give it a shot! ;)

  • rrodriguezrrodriguez USMember

    Thanks @DannyC, I'm taking a look at it. I have no experience with objective-c but let's see what I can do.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @rrodriquez,

    I was curious about this the other day, and I came across this. Its in obj-c, but you might be able to learn from it and port it to c#.

  • rrodriguezrrodriguez USMember

    Thanks @John!

  • DannyCDannyC US ✭✭✭✭

    Thanks for the link @John, shall check it out.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @rrodriquez @DannyC,

    Attached is a start. Probably some more "best practices" you can add in, but it works.

    Enjoy!

  • DannyCDannyC US ✭✭✭✭

    Nice, will test it out. Thanks @John

  • rrodriguezrrodriguez USMember

    Great @John! Thanks!

  • rrodriguezrrodriguez USMember

    Guys, I could successfully use @John's code.
    I'm setting the scrollViewContentView with a UIView with a custom layout.
    Something I noticed is that after doing this, the RowSelected in the Source is not being fired anymore.
    Is like the cell is not firing this event anymore due to the scroll view content blocking the ability of the cell to respond to the touch.

    Any ideas on how to tackle this?

  • rrodriguezrrodriguez USMember
    edited November 2013

    Ok, it looks that by design the UIScrollView wont allow the UITableViewCell to handle the gestures if the scroll view is on its full extent.

    I added this gesture recognizer to the scroll view:

    _tapGestureRecognizer = new UITapGestureRecognizer (); _tapGestureRecognizer.AddTarget (() => { if (_scrollView.ContentOffset != PointF.Empty) return; var table = this.Superview.Superview as UITableView; var indexPath = table.IndexPathForCell (this); table.Source.RowSelected (table, indexPath); });

    And it is now working.
    I'm not proud of it, I'm wondering if there is any other way around this, a cleaner one.

  • JoeFeinourJoeFeinour USMember

    I wrote a port of the SWTableViewCell here https://github.com/feinoujc/Xamarin-SWTableViewCell

  • JoeFeinourJoeFeinour USMember

    Official version in component store actually https://t.co/GPMFZdQhmM

  • AlexReyesAlexReyes USUniversity ✭✭

    Anybody tried to use this in Xamarin Forms?

Sign In or Register to comment.