在我的应用程序中,我想在React-native中禁用IOS的屏幕截图功能。
请向我建议可以在IOS中禁用屏幕截图的任何可用软件包或任何本机代码。
答案 0 :(得分:0)
这是库反应本机阻止屏幕截图的解决方案之一:,查看链接rn-screenshot
覆盖屏幕,方法是将两个两个添加到appDelegate.m
- (void)applicationWillResignActive:(UIApplication *)application {
// fill screen with our own colour
UIView *colourView = [[UIView alloc]initWithFrame:self.window.frame];
colourView.backgroundColor = [UIColor whiteColor];
colourView.tag = 1234;
colourView.alpha = 0;
[self.window addSubview:colourView];
[self.window bringSubviewToFront:colourView];
// fade in the view
[UIView animateWithDuration:0.5 animations:^{
colourView.alpha = 1;
}];
}
- (void)applicationDidBecomeActive:(UIApplication \*)application {
// grab a reference to our coloured view
UIView \*colourView = [self.window viewWithTag:1234];
// fade away colour view from main view
[UIView animateWithDuration:0.5 animations:^{
colourView.alpha = 0;
} completion:^(BOOL finished) {
// remove when finished fading
[colourView removeFromSuperview];
}];
}