Forum Discussion

rani_mantriprag's avatar
rani_mantriprag
New Contributor
10 years ago
Solved

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, generates the following line but running it fails with "Object doesn't support this property"error. Please let me know if there's any work around for swipe action.



Sub Test

Mobile.Device.Process("x").Window.TableView.TableViewCell(1, 0).ScrollView.wPositionX = 82

End Sub



Thanks!



  • 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

4 Replies

  • cgreenspan's avatar
    cgreenspan
    Occasional Contributor

    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

    • soujanya's avatar
      soujanya
      New Contributor

      Hi Corey,

       

       

      thanks for the reply.

       

      your solution worked for me.

       

      Soujanya

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Rani,

     


    Can you check whether the Swipe method is applied to the app window or the table window? You could try calling it. Please read the "Swipe Method" article for details.


     

    • soujanya's avatar
      soujanya
      New Contributor

      In our iOS app, we have a table and swiping from right to left on any cell activates the Custom button.

       

      Using TC, I am not able to perform the swipe action. Recording the swipe action in the UI, generates the following line but running it fails with "min =0 max =30 , set to 30" error. Please let me know if there's any work around for swipe action.

      tried different options but no sucess, please hlep me here

      Aliases.Device.processSaminspectTc.window0.tableview0.TableViewCell0_0.scrollview0.wPositionX = 95;

       

      thanks in advance