Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

iphone - Xamarin forms Stop screen shot and record in ios

I have xamarin forms app and need to prevent user from take screen shot or record screen these implemented for android using these: Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure); is there any we to do these for ios

Thanks

question from:https://stackoverflow.com/questions/65670939/xamarin-forms-stop-screen-shot-and-record-in-ios

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Like Jason said, you could find more information in Google. You could try the code below for ios to blur or hide the screenshot taken, to hide sensitive information. I hope this would be helpful for you.

A easy way is to set a blur when the AppDelegate calls OnResignActivation.

UIVisualEffectView _blurWindow = null;

public override void OnActivated(UIApplication application)
{
base.OnActivated(application);

_blurWindow?.RemoveFromSuperview();
_blurWindow?.Dispose();
_blurWindow = null;
}

public override void OnResignActivation(UIApplication application)
{
base.OnResignActivation(application);

using (var blurEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Dark))
{
    _blurWindow = new UIVisualEffectView(blurEffect)
    {
        Frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Bounds
    };
    UIApplication.SharedApplication.KeyWindow.RootViewController.View.AddSubview(_blurWindow);
 }
}

I use Dark here. You could change the blur effect to Light, Regular or any of the other options listed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...