Forum Discussion

rani_mantriprag's avatar
rani_mantriprag
New Contributor
11 years ago

iOS: Performing swipe action on the tablecell.

In our iOS app, we have a table and swiping from right to left on any cell activates the delete button. Using TC, I am not able to perform the swipe action. Recording the swipe action in the UI, ge...
  • cgreenspan's avatar
    10 years ago

    We've had some issues with this in the past too, but I think we have found a good solution to swipe from right to left in a TableVewCell. An example procedure is below (in DelphiScript). It finds the coordinates by using the cell's position and size, then swipes. Just pass in the TableViewCell object:

    procedure SwipeToExposeRemoveButton(oTableViewCell : OleVariant);
    var
    iScreenTop, iScreenLeft, xStart, yStart, xEnd, yEnd : integer;
    begin


        iScreenTop  := oTableViewCell.ScreenTop;  // Get distance from top of cell to top of screen
        iScreenLeft := oTableViewCell.ScreenLeft;  // Get distance from left of cell to left of screen

        // Define start and end coordinates to swipe
        xStart := iScreenLeft + oTableViewCell.Width * 0.99;  // Distance left of object + 99/100 the width of cell
        yStart := oTableViewCell.Height/2 + iScreenTop;         // Middle of cell heightwise
        xEnd   := iScreenLeft + oTableViewCell.Width * 0.01; // Distance left of object + 1/100 the width of cell
        yEnd   := yStart;
        
        // Swipe to expose remove button
        Mobile.Device.Swipe(xStart, yStart, xEnd, yEnd, 5, 200);
           
    end;

     

    Hope this helps!

    -Corey