iOS Question Prevent, stop right swipe jesture going to previous page

mcvburen

Member
Licensed User
Hello,

I use the navigation controller and when two or more pages deep from my home page, swiping to the right from the far left side takes the app to the previous page (as if the top left back button were pressed). I need to stop this behavior on one page where the user must draw on the screen to a canvas. Drawing motions that start on the far left can accidentally pull and grab the screen, sending it right which can lead to it going to the previous page. I just need a way to freeze the page from the left to right gesture forcing the user to use the top left back button instead.

I have researched the site and cannot find a way to do this. Basically I need a way to consume this swipe event like a back button is consumed in B4A android.

Any help on this would be great.

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
A simple solution is to set HideBackButton to true. This will disable the swipe gesture and remove the back key. You can add a similar button with:
B4X:
Public Sub Show
   If pg.IsInitialized = False Then
       pg.Initialize("pg")
       pg.RootPanel.LoadLayout("Page1Layout")
       pg.HideBackButton = True '<-- don't want to allow the user to return to the login screen
       Dim bb As BarButton
       bb.InitializeText("Back", "Back")
       pg.TopLeftButtons = Array(bb)
   End If
   Main.NavControl.ShowPage(pg)
End Sub

Sub pg_BarButtonClick (Tag As String)
   If Tag = "Back" Then
       Main.NavControl.RemoveCurrentPage
   End If
End Sub
 
Upvote 0
Top