iOS Question Prevent screenshot iOS

tsteward

Well-Known Member
Licensed User
Longtime User
Is there a B4i version of this code
B4X:
Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)
   Dim no As NativeObject = Me
   no.RunMethod("addListener", Null)
End Sub

#if OBJC
- (void)addListener {
  [[NSNotificationCenter defaultCenter] addObserver:self
  selector:@selector(_screenshot_taken)
  name:UIApplicationUserDidTakeScreenshotNotification  object:nil];
}
#end if

Private Sub Screenshot_Taken
   Log("Screenshot taken")
End Sub

I did find this when search www
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I tried the suggestion with a hidden text view. It doesn't seem to work on iOS 26.

B4X:
TextView1.As(NativeObject).SetField("secureTextEntry", True)

The field itself will not appear in the screenshot (if visible).

Maybe you can hide the content when the app moves to the background or in one of the other page events.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…