├── BanScreenshotDemo
├── 123.jpg
├── Assets.xcassets
│ ├── Contents.json
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── ViewController.h
├── Info.plist
├── ViewController1.h
├── ViewController2.h
├── ViewController4.h
├── ViewController5.h
├── AppDelegate.h
├── MAScreenShieldView.h
├── ViewController3.h
├── BaseViewController.h
├── ViewController5.m
├── AppDelegate.m
├── main.m
├── BaseViewController.m
├── ViewController4.m
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── ViewController2.m
├── ViewController3.m
├── ViewController1.m
├── MAScreenShieldView.m
└── ViewController.m
├── README.md
├── BanScreenshotDemo.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── project.pbxproj
├── Podfile
├── BanScreenshotDemo.xcworkspace
└── contents.xcworkspacedata
└── LICENSE
/BanScreenshotDemo/123.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyunjue/BanScreenshotDemo/HEAD/BanScreenshotDemo/123.jpg
--------------------------------------------------------------------------------
/BanScreenshotDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BanScreenshotDemo
2 | iOS 禁止截屏,手机截屏时隐藏内容,或自定义截屏后的内容
3 |
4 |
5 | # iOS13.2以下不支持,如果不使用MAScreenShieldView而是自己处理,请着重测试下iOS15.0和iOS15.1,这两个版本容易崩溃
6 |
7 | [简书地址](https://www.jianshu.com/p/537053a0854f)
8 |
--------------------------------------------------------------------------------
/BanScreenshotDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 |
10 | @interface ViewController : UIViewController
11 |
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | target 'BanScreenshotDemo' do
5 | # Comment the next line if you don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | pod "MAAutoLayout"
9 |
10 | end
11 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPhotoLibraryAddUsageDescription
6 | 是否允许APP添加照片到相册?
7 |
8 |
9 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController1.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController1.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface ViewController1 : UIViewController
13 |
14 | @end
15 |
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController2.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController2.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface ViewController2 : UIViewController
13 |
14 | @end
15 |
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController4.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController4.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/4/14.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface ViewController4 : UIViewController
13 |
14 | @end
15 |
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController5.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController5.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/4/14.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface ViewController5 : UIViewController
13 |
14 | @end
15 |
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/BanScreenshotDemo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 |
10 | @interface AppDelegate : UIResponder
11 |
12 | @property (nonatomic, strong) UIWindow *window;
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/MAScreenShieldView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAScreenShieldView.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/24.
6 | //
7 |
8 | #import
9 |
10 | API_AVAILABLE(ios(13.2))
11 | @interface MAScreenShieldView : UIView
12 |
13 | + (UIView *)creactWithFrame:(CGRect)frame;
14 |
15 | @end
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController3.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController3.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 | #import "BaseViewController.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface ViewController3 : BaseViewController
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/BaseViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BaseViewController.h
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface BaseViewController : UIViewController
13 |
14 | @property (nonatomic, assign) BOOL banScreenshot;
15 |
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController5.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController5.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/4/14.
6 | //
7 |
8 | #import "ViewController5.h"
9 |
10 | @interface ViewController5 ()
11 |
12 | @end
13 |
14 | @implementation ViewController5
15 |
16 | - (void)viewDidLoad {
17 | [super viewDidLoad];
18 | // Do any additional setup after loading the view.
19 | }
20 |
21 |
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "AppDelegate.h"
9 |
10 | @interface AppDelegate ()
11 |
12 | @end
13 |
14 | @implementation AppDelegate
15 |
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
18 | // Override point for customization after application launch.
19 | return YES;
20 | }
21 |
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import
9 | #import "AppDelegate.h"
10 |
11 | int main(int argc, char * argv[]) {
12 | NSString * appDelegateClassName;
13 | @autoreleasepool {
14 | // Setup code that might create autoreleased objects goes here.
15 | appDelegateClassName = NSStringFromClass([AppDelegate class]);
16 | }
17 | return UIApplicationMain(argc, argv, nil, appDelegateClassName);
18 | }
19 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/BaseViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BaseViewController.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "BaseViewController.h"
9 | #import "MAScreenShieldView.h"
10 |
11 | @interface BaseViewController ()
12 |
13 | @end
14 |
15 | @implementation BaseViewController
16 |
17 | - (void)loadView {
18 | if (self.banScreenshot) {
19 | if (@available(iOS 13.2, *)) {
20 | self.view = [MAScreenShieldView creactWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
21 | }else{
22 | [super loadView];
23 | }
24 | }else{
25 | [super loadView];
26 | }
27 | self.view.userInteractionEnabled = YES;
28 | self.view.backgroundColor = [UIColor whiteColor];
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController4.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController4.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/4/14.
6 | //
7 |
8 | #import "ViewController4.h"
9 | #import "MAAutoLayout.h"
10 |
11 | @interface ViewController4 ()
12 |
13 | @property (nonatomic, strong) UILabel *label;
14 | @property (weak, nonatomic) IBOutlet UIImageView *imageView;
15 |
16 | @end
17 |
18 | @implementation ViewController4
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 | [self.view addSubview:self.label];
24 | [self.label ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
25 | make.top.equalTo(self.imageView.ma_bottom).offset(20);
26 | make.centerX.equalTo(self.view);
27 | }];
28 | }
29 |
30 |
31 | - (UILabel *)label{
32 | if(!_label){
33 | _label = [[UILabel alloc]init];
34 | _label.text = @"上面的图片在截图时会隐藏起来";
35 | }
36 | return _label;
37 | }
38 | @end
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 fengyunjue
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController2.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController2.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "ViewController2.h"
9 | #import "MAAutoLayout.h"
10 |
11 | @interface ViewController2 ()
12 |
13 | @property (nonatomic, strong) UIImageView *imageView;
14 | @property (nonatomic, strong) UITextField *textField;
15 | @property (nonatomic, strong) UILabel *label;
16 |
17 | @end
18 |
19 | @implementation ViewController2
20 |
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.view.backgroundColor = [UIColor whiteColor];
25 |
26 | [self.view addSubview:self.label];
27 | [self.label ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
28 | make.center.equalTo(self.view);
29 | }];
30 |
31 | UIView *theView = self.textField.subviews.firstObject;
32 | [self.view addSubview:theView];
33 | theView.userInteractionEnabled = YES;
34 | [theView addSubview:self.imageView];
35 | [theView ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
36 | make.edge.equalTo(self.view);
37 | }];
38 | [self.imageView ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
39 | make.center.equalTo(theView);
40 | }];
41 | }
42 |
43 | - (UIImageView *)imageView {
44 | if (!_imageView) {
45 | _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"123.jpg"]];
46 | _imageView.userInteractionEnabled = YES;
47 | }
48 | return _imageView;
49 | }
50 |
51 | - (UITextField *)textField {
52 | if (!_textField) {
53 | _textField = [[UITextField alloc] init];
54 | _textField.secureTextEntry = YES;
55 | _textField.enabled = NO;
56 | }
57 | return _textField;
58 | }
59 |
60 | - (UILabel *)label{
61 | if(!_label){
62 | _label = [[UILabel alloc]init];
63 | _label.text = @"禁止截图";
64 | }
65 | return _label;
66 | }
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController3.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController3.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "ViewController3.h"
9 | #import "MAAutoLayout.h"
10 |
11 | @interface ViewController3 ()
12 |
13 | @property (nonatomic, strong) UITableView *tableView;
14 |
15 | @end
16 |
17 | @implementation ViewController3
18 |
19 | - (BOOL)banScreenshot {
20 | return YES;
21 | }
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 |
26 | [self.view addSubview:self.tableView];
27 | [self.tableView ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
28 | make.edge.equalToSuperView();
29 | }];
30 |
31 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"移除" style:UIBarButtonItemStyleDone target:self action:@selector(removeTableView)];
32 | }
33 |
34 | - (void)removeTableView {
35 | [self.tableView removeFromSuperview];
36 | }
37 |
38 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
39 | return 100;
40 | }
41 |
42 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
43 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELLID" forIndexPath:indexPath];
44 | cell.textLabel.text = [NSString stringWithFormat:@"Cell-%ld",(long)indexPath.row];
45 | return cell;
46 | }
47 |
48 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
49 | NSLog(@"点击了第%ld行",(long)indexPath.row);
50 | }
51 |
52 |
53 | - (UITableView *)tableView{
54 | if(!_tableView){
55 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
56 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CELLID"];
57 | _tableView.rowHeight = 44;
58 | _tableView.delegate = self;
59 | _tableView.dataSource = self;
60 | }
61 | return _tableView;
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController1.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController1.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "ViewController1.h"
9 | #import "MAAutoLayout.h"
10 |
11 | @interface ViewController1 ()
12 |
13 | @property (nonatomic, strong) UIImageView *imageView;
14 | @property (nonatomic, strong) UITextField *textField;
15 | @property (nonatomic, strong) UILabel *label;
16 |
17 | @end
18 |
19 | @implementation ViewController1
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 | self.view.backgroundColor = [UIColor whiteColor];
24 |
25 | UIView *theView = self.textField.subviews.firstObject;
26 | [self.view addSubview:theView];
27 | theView.userInteractionEnabled = YES;
28 | [theView addSubview:self.imageView];
29 | [theView ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
30 | make.top.equalTo(self.ma_safeAreaTopLayoutGuide);
31 | make.leftRight.equalTo(self.view);
32 | make.width.equalTo(theView.ma_height);
33 | }];
34 | [self.imageView ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
35 | make.edge.equalTo(theView);
36 | }];
37 |
38 | [self.view addSubview:self.label];
39 | [self.label ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
40 | make.top.equalTo(theView.ma_bottom).offset(100);
41 | make.centerX.equalTo(self.view);
42 | }];
43 | }
44 |
45 | - (UIImageView *)imageView {
46 | if (!_imageView) {
47 | _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"123.jpg"]];
48 | _imageView.userInteractionEnabled = YES;
49 | [_imageView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapView)]];
50 | }
51 | return _imageView;
52 | }
53 |
54 | - (void)tapView {
55 | NSLog(@"点击图片");
56 | }
57 |
58 | - (UITextField *)textField {
59 | if (!_textField) {
60 | _textField = [[UITextField alloc] init];
61 | _textField.secureTextEntry = YES;
62 | _textField.enabled = NO;
63 | }
64 | return _textField;
65 | }
66 |
67 | - (UILabel *)label{
68 | if(!_label){
69 | _label = [[UILabel alloc]init];
70 | _label.text = @"上面的图片在截图时会隐藏起来";
71 | }
72 | return _label;
73 | }
74 | @end
75 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/MAScreenShieldView.m:
--------------------------------------------------------------------------------
1 | //
2 | // MAScreenShieldView.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/24.
6 | //
7 |
8 | #import "MAScreenShieldView.h"
9 |
10 | /// 仿照https://github.com/RyukieSama/Swifty/blob/master/Swifty/Classes/UIKit/UIView/View/ScreenShieldView.swift写的,不过Swifty上的有bug,->在iOS15.0和iOS15.1时,点击到禁止截图界面然后退到后台再进入APP,APP会崩溃
11 | @interface MAScreenShieldView()
12 |
13 | @property (nonatomic, strong) UITextField *textField;
14 | @property (nonatomic, strong) UIView *safeZone;
15 |
16 | @end
17 |
18 | @implementation MAScreenShieldView
19 |
20 | + (UIView *)creactWithFrame:(CGRect)frame {
21 | return [[MAScreenShieldView alloc] initWithFrame:frame];
22 | }
23 |
24 | - (instancetype)initWithCoder:(NSCoder *)coder {
25 | self = [super initWithCoder:coder];
26 | if (self) {
27 | [self addSafeZoneView];
28 | }
29 | return self;
30 | }
31 |
32 | - (instancetype)initWithFrame:(CGRect)frame {
33 | self = [super initWithFrame:frame];
34 | if (self) {
35 | [self addSafeZoneView];
36 | }
37 | return self;
38 | }
39 |
40 | - (void)addSafeZoneView {
41 | [self addSubview:self.safeZone];
42 |
43 | UILayoutPriority lowPriority = UILayoutPriorityDefaultLow - 1;
44 | UILayoutPriority heightPriority = UILayoutPriorityDefaultHigh - 1;
45 |
46 | self.safeZone.translatesAutoresizingMaskIntoConstraints = NO;
47 | [self.safeZone setContentHuggingPriority:lowPriority forAxis:UILayoutConstraintAxisVertical];
48 | [self.safeZone setContentHuggingPriority:lowPriority forAxis:UILayoutConstraintAxisHorizontal];
49 | [self.safeZone setContentCompressionResistancePriority:heightPriority forAxis:UILayoutConstraintAxisVertical];
50 | [self.safeZone setContentCompressionResistancePriority:heightPriority forAxis:UILayoutConstraintAxisHorizontal];
51 |
52 | [self addConstraints:@[
53 | [NSLayoutConstraint constraintWithItem:self.safeZone attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0],
54 | [NSLayoutConstraint constraintWithItem:self.safeZone attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0],
55 | [NSLayoutConstraint constraintWithItem:self.safeZone attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeading multiplier:1 constant:0],
56 | [NSLayoutConstraint constraintWithItem:self.safeZone attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTrailing multiplier:1 constant:0],
57 | ]];
58 | }
59 |
60 | - (void)addSubview:(UIView *)view {
61 | if (self.safeZone == view) {
62 | [super addSubview:view];
63 | }else{
64 | [self.safeZone addSubview:view];
65 | }
66 | }
67 |
68 | - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index {
69 | if (self.safeZone == view) {
70 | [super insertSubview:view atIndex:index];
71 | }else{
72 | [self.safeZone insertSubview:view atIndex:index];
73 | }
74 | }
75 |
76 | - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview {
77 | if (self.safeZone == view) {
78 | [super insertSubview:view aboveSubview:siblingSubview];
79 | }else{
80 | [self.safeZone insertSubview:view aboveSubview:siblingSubview];
81 | }
82 | }
83 |
84 | - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview {
85 | if (self.safeZone == view) {
86 | [super insertSubview:view belowSubview:siblingSubview];
87 | }else{
88 | [self.safeZone insertSubview:view belowSubview:siblingSubview];
89 | }
90 | }
91 |
92 | - (UITextField *)textField{
93 | if(!_textField){
94 | _textField = [[UITextField alloc]init];
95 | _textField.secureTextEntry = YES;
96 | _textField.enabled = NO;
97 | }
98 | return _textField;
99 | }
100 |
101 | - (UIView *)safeZone{
102 | if(!_safeZone){
103 | _safeZone = self.textField.subviews.firstObject ?: [[UIView alloc] init];
104 | _safeZone.userInteractionEnabled = YES;
105 | for (UIView *v in _safeZone.subviews) {
106 | [v removeFromSuperview];
107 | }
108 | }
109 | return _safeZone;
110 | }
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // BanScreenshotDemo
4 | //
5 | // Created by fengyunjue on 2022/3/22.
6 | //
7 |
8 | #import "ViewController.h"
9 | #import "MAAutoLayout.h"
10 | #import "ViewController1.h"
11 | #import "ViewController2.h"
12 | #import "ViewController3.h"
13 |
14 | @interface ViewController ()
15 |
16 | @property (nonatomic, strong) UITextField *textField;
17 | @property (nonatomic, strong) UIButton *banScreenshotButton;
18 | @property (nonatomic, strong) UIButton *banScreenshotButton2;
19 | @property (nonatomic, strong) UIButton *button;
20 | @property (nonatomic, strong) UILabel *label;
21 |
22 | @end
23 |
24 | @implementation ViewController
25 |
26 | - (void)viewDidLoad {
27 | [super viewDidLoad];
28 |
29 | [self.view addSubview:self.textField];
30 | [self.view addSubview:self.banScreenshotButton];
31 | [self.view addSubview:self.banScreenshotButton2];
32 | [self.view addSubview:self.button];
33 | [self.view addSubview:self.label];
34 | [self.textField ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
35 | make.top.equalTo(self.view).offset(100);
36 | make.leftRight.equalTo(self.view).offsets(20);
37 | make.height.ma_equal(44);
38 | }];
39 | [self.banScreenshotButton ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
40 | make.top.equalTo(self.textField.ma_bottom).offset(100);
41 | make.centerX.equalTo(self.view);
42 | }];
43 | [self.banScreenshotButton2 ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
44 | make.top.equalTo(self.banScreenshotButton.ma_bottom).offset(100);
45 | make.centerX.equalTo(self.view);
46 | }];
47 | [self.button ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
48 | make.top.equalTo(self.banScreenshotButton2.ma_bottom).offset(100);
49 | make.centerX.equalTo(self.view);
50 | }];
51 | [self.label ma_makeConstraints:^(MAAutoLayout * _Nonnull make) {
52 | make.leftRight.equalTo(self.view).offsets(30);
53 | make.bottom.equalTo(self.view).offset(-50);
54 | }];
55 | }
56 |
57 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
58 | [self.textField resignFirstResponder];
59 | }
60 |
61 | - (UITextField *)textField{
62 | if(!_textField){
63 | _textField = [[UITextField alloc]init];
64 | _textField.layer.cornerRadius = 5;
65 | _textField.layer.borderWidth =1;
66 | _textField.layer.borderColor = [UIColor blackColor].CGColor;
67 | _textField.secureTextEntry = YES;
68 | }
69 | return _textField;
70 | }
71 |
72 | - (UIButton *)banScreenshotButton{
73 | if(!_banScreenshotButton){
74 | _banScreenshotButton = [UIButton buttonWithType:UIButtonTypeCustom];
75 | [_banScreenshotButton addTarget:self action:@selector(clickBanScreenshotButton) forControlEvents:UIControlEventTouchUpInside];
76 | [_banScreenshotButton setTitle:@"禁止截屏" forState:UIControlStateNormal];
77 | [_banScreenshotButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
78 | }
79 | return _banScreenshotButton;
80 | }
81 |
82 | - (void)clickBanScreenshotButton {
83 | [self.navigationController pushViewController:[[ViewController1 alloc]init] animated:YES];
84 | }
85 |
86 | - (UIButton *)banScreenshotButton2{
87 | if(!_banScreenshotButton2){
88 | _banScreenshotButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
89 | [_banScreenshotButton2 addTarget:self action:@selector(clickBanScreenshotButton2) forControlEvents:UIControlEventTouchUpInside];
90 | [_banScreenshotButton2 setTitle:@"禁止截屏2" forState:UIControlStateNormal];
91 | [_banScreenshotButton2 setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
92 | }
93 | return _banScreenshotButton2;
94 | }
95 |
96 | - (void)clickBanScreenshotButton2 {
97 | [self.navigationController pushViewController:[[ViewController2 alloc]init] animated:YES];
98 | }
99 |
100 | - (UIButton *)button{
101 | if(!_button){
102 | _button = [UIButton buttonWithType:UIButtonTypeCustom];
103 | [_button addTarget:self action:@selector(clickButton) forControlEvents:UIControlEventTouchUpInside];
104 | [_button setTitle:@"TableView" forState:UIControlStateNormal];
105 | [_button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
106 | }
107 | return _button;
108 | }
109 |
110 | - (void)clickButton {
111 | [self.navigationController pushViewController:[[ViewController3 alloc]init] animated:YES];
112 | }
113 |
114 |
115 | - (UILabel *)label{
116 | if(!_label){
117 | _label = [[UILabel alloc]init];
118 | _label.text = @"截图测试,请点击模拟器菜单\nDevice->Trigger Screenshot";
119 | _label.numberOfLines = 0;
120 | _label.textAlignment = NSTextAlignmentCenter;
121 | }
122 | return _label;
123 | }
124 | @end
125 |
--------------------------------------------------------------------------------
/BanScreenshotDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/BanScreenshotDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 55;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8415FFE327E9BB730035EB9D /* ViewController1.m in Sources */ = {isa = PBXBuildFile; fileRef = 8415FFE227E9BB730035EB9D /* ViewController1.m */; };
11 | 8415FFE627E9BF5B0035EB9D /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8415FFE527E9BF5B0035EB9D /* BaseViewController.m */; };
12 | 8415FFE927E9C1150035EB9D /* ViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = 8415FFE827E9C1150035EB9D /* ViewController2.m */; };
13 | 8415FFEC27E9CAE10035EB9D /* ViewController3.m in Sources */ = {isa = PBXBuildFile; fileRef = 8415FFEB27E9CAE10035EB9D /* ViewController3.m */; };
14 | 849297C527EC3F0900FD9A76 /* MAScreenShieldView.m in Sources */ = {isa = PBXBuildFile; fileRef = 849297C427EC3F0900FD9A76 /* MAScreenShieldView.m */; };
15 | 84A074BE27E9B68500EF4821 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A074BD27E9B68500EF4821 /* AppDelegate.m */; };
16 | 84A074C427E9B68500EF4821 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A074C327E9B68500EF4821 /* ViewController.m */; };
17 | 84A074C727E9B68500EF4821 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84A074C527E9B68500EF4821 /* Main.storyboard */; };
18 | 84A074C927E9B68600EF4821 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84A074C827E9B68600EF4821 /* Assets.xcassets */; };
19 | 84A074CC27E9B68600EF4821 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84A074CA27E9B68600EF4821 /* LaunchScreen.storyboard */; };
20 | 84A074CF27E9B68600EF4821 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A074CE27E9B68600EF4821 /* main.m */; };
21 | 84A074D827E9B6D500EF4821 /* 123.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 84A074D527E9B6D500EF4821 /* 123.jpg */; };
22 | 84C03FB72808138100FE89BD /* ViewController4.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C03FB62808138100FE89BD /* ViewController4.m */; };
23 | 84C03FBA2808165600FE89BD /* ViewController5.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C03FB92808165600FE89BD /* ViewController5.m */; };
24 | 8C072E2EADCF032D162539A0 /* Pods_BanScreenshotDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3AB33E1EB4E4B1CCA83832F /* Pods_BanScreenshotDemo.framework */; };
25 | /* End PBXBuildFile section */
26 |
27 | /* Begin PBXFileReference section */
28 | 2AEB140A2ABDB1FC8C35F3E2 /* Pods-BanScreenshotDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BanScreenshotDemo.release.xcconfig"; path = "Target Support Files/Pods-BanScreenshotDemo/Pods-BanScreenshotDemo.release.xcconfig"; sourceTree = ""; };
29 | 584E99FD005967B78F832D81 /* Pods-BanScreenshotDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BanScreenshotDemo.debug.xcconfig"; path = "Target Support Files/Pods-BanScreenshotDemo/Pods-BanScreenshotDemo.debug.xcconfig"; sourceTree = ""; };
30 | 8415FFE127E9BB730035EB9D /* ViewController1.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController1.h; sourceTree = ""; };
31 | 8415FFE227E9BB730035EB9D /* ViewController1.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController1.m; sourceTree = ""; };
32 | 8415FFE427E9BF5B0035EB9D /* BaseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = ""; };
33 | 8415FFE527E9BF5B0035EB9D /* BaseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = ""; };
34 | 8415FFE727E9C1150035EB9D /* ViewController2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController2.h; sourceTree = ""; };
35 | 8415FFE827E9C1150035EB9D /* ViewController2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController2.m; sourceTree = ""; };
36 | 8415FFEA27E9CAE10035EB9D /* ViewController3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController3.h; sourceTree = ""; };
37 | 8415FFEB27E9CAE10035EB9D /* ViewController3.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController3.m; sourceTree = ""; };
38 | 849297C327EC3F0900FD9A76 /* MAScreenShieldView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MAScreenShieldView.h; sourceTree = ""; };
39 | 849297C427EC3F0900FD9A76 /* MAScreenShieldView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MAScreenShieldView.m; sourceTree = ""; };
40 | 84A074B927E9B68500EF4821 /* BanScreenshotDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BanScreenshotDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 84A074BC27E9B68500EF4821 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
42 | 84A074BD27E9B68500EF4821 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
43 | 84A074C227E9B68500EF4821 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
44 | 84A074C327E9B68500EF4821 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
45 | 84A074C627E9B68500EF4821 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
46 | 84A074C827E9B68600EF4821 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
47 | 84A074CB27E9B68600EF4821 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
48 | 84A074CD27E9B68600EF4821 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 84A074CE27E9B68600EF4821 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
50 | 84A074D527E9B6D500EF4821 /* 123.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 123.jpg; sourceTree = ""; };
51 | 84C03FB52808138100FE89BD /* ViewController4.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController4.h; sourceTree = ""; };
52 | 84C03FB62808138100FE89BD /* ViewController4.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController4.m; sourceTree = ""; };
53 | 84C03FB82808165600FE89BD /* ViewController5.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController5.h; sourceTree = ""; };
54 | 84C03FB92808165600FE89BD /* ViewController5.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController5.m; sourceTree = ""; };
55 | D3AB33E1EB4E4B1CCA83832F /* Pods_BanScreenshotDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BanScreenshotDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
56 | /* End PBXFileReference section */
57 |
58 | /* Begin PBXFrameworksBuildPhase section */
59 | 84A074B627E9B68500EF4821 /* Frameworks */ = {
60 | isa = PBXFrameworksBuildPhase;
61 | buildActionMask = 2147483647;
62 | files = (
63 | 8C072E2EADCF032D162539A0 /* Pods_BanScreenshotDemo.framework in Frameworks */,
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | /* End PBXFrameworksBuildPhase section */
68 |
69 | /* Begin PBXGroup section */
70 | 71D5A051AA4E3A6285346641 /* Frameworks */ = {
71 | isa = PBXGroup;
72 | children = (
73 | D3AB33E1EB4E4B1CCA83832F /* Pods_BanScreenshotDemo.framework */,
74 | );
75 | name = Frameworks;
76 | sourceTree = "";
77 | };
78 | 79190B828FC91A1ECFF587C8 /* Pods */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 584E99FD005967B78F832D81 /* Pods-BanScreenshotDemo.debug.xcconfig */,
82 | 2AEB140A2ABDB1FC8C35F3E2 /* Pods-BanScreenshotDemo.release.xcconfig */,
83 | );
84 | path = Pods;
85 | sourceTree = "";
86 | };
87 | 84A074B027E9B68400EF4821 = {
88 | isa = PBXGroup;
89 | children = (
90 | 84A074BB27E9B68500EF4821 /* BanScreenshotDemo */,
91 | 84A074BA27E9B68500EF4821 /* Products */,
92 | 79190B828FC91A1ECFF587C8 /* Pods */,
93 | 71D5A051AA4E3A6285346641 /* Frameworks */,
94 | );
95 | sourceTree = "";
96 | };
97 | 84A074BA27E9B68500EF4821 /* Products */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 84A074B927E9B68500EF4821 /* BanScreenshotDemo.app */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 84A074BB27E9B68500EF4821 /* BanScreenshotDemo */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 84A074BC27E9B68500EF4821 /* AppDelegate.h */,
109 | 84A074BD27E9B68500EF4821 /* AppDelegate.m */,
110 | 84A074C227E9B68500EF4821 /* ViewController.h */,
111 | 84A074C327E9B68500EF4821 /* ViewController.m */,
112 | 8415FFE127E9BB730035EB9D /* ViewController1.h */,
113 | 8415FFE227E9BB730035EB9D /* ViewController1.m */,
114 | 8415FFE727E9C1150035EB9D /* ViewController2.h */,
115 | 8415FFE827E9C1150035EB9D /* ViewController2.m */,
116 | 8415FFEA27E9CAE10035EB9D /* ViewController3.h */,
117 | 8415FFEB27E9CAE10035EB9D /* ViewController3.m */,
118 | 84C03FB52808138100FE89BD /* ViewController4.h */,
119 | 84C03FB62808138100FE89BD /* ViewController4.m */,
120 | 84C03FB82808165600FE89BD /* ViewController5.h */,
121 | 84C03FB92808165600FE89BD /* ViewController5.m */,
122 | 8415FFE427E9BF5B0035EB9D /* BaseViewController.h */,
123 | 8415FFE527E9BF5B0035EB9D /* BaseViewController.m */,
124 | 849297C327EC3F0900FD9A76 /* MAScreenShieldView.h */,
125 | 849297C427EC3F0900FD9A76 /* MAScreenShieldView.m */,
126 | 84A074C527E9B68500EF4821 /* Main.storyboard */,
127 | 84A074C827E9B68600EF4821 /* Assets.xcassets */,
128 | 84A074CA27E9B68600EF4821 /* LaunchScreen.storyboard */,
129 | 84A074D527E9B6D500EF4821 /* 123.jpg */,
130 | 84A074CD27E9B68600EF4821 /* Info.plist */,
131 | 84A074CE27E9B68600EF4821 /* main.m */,
132 | );
133 | path = BanScreenshotDemo;
134 | sourceTree = "";
135 | };
136 | /* End PBXGroup section */
137 |
138 | /* Begin PBXNativeTarget section */
139 | 84A074B827E9B68500EF4821 /* BanScreenshotDemo */ = {
140 | isa = PBXNativeTarget;
141 | buildConfigurationList = 84A074D227E9B68600EF4821 /* Build configuration list for PBXNativeTarget "BanScreenshotDemo" */;
142 | buildPhases = (
143 | F38D64029E188CF877C4C1E4 /* [CP] Check Pods Manifest.lock */,
144 | 84A074B527E9B68500EF4821 /* Sources */,
145 | 84A074B627E9B68500EF4821 /* Frameworks */,
146 | 84A074B727E9B68500EF4821 /* Resources */,
147 | FE0DFFAE435D28DBE8572250 /* [CP] Embed Pods Frameworks */,
148 | );
149 | buildRules = (
150 | );
151 | dependencies = (
152 | );
153 | name = BanScreenshotDemo;
154 | productName = BanScreenshotDemo;
155 | productReference = 84A074B927E9B68500EF4821 /* BanScreenshotDemo.app */;
156 | productType = "com.apple.product-type.application";
157 | };
158 | /* End PBXNativeTarget section */
159 |
160 | /* Begin PBXProject section */
161 | 84A074B127E9B68400EF4821 /* Project object */ = {
162 | isa = PBXProject;
163 | attributes = {
164 | BuildIndependentTargetsInParallel = 1;
165 | LastUpgradeCheck = 1330;
166 | TargetAttributes = {
167 | 84A074B827E9B68500EF4821 = {
168 | CreatedOnToolsVersion = 13.3;
169 | };
170 | };
171 | };
172 | buildConfigurationList = 84A074B427E9B68400EF4821 /* Build configuration list for PBXProject "BanScreenshotDemo" */;
173 | compatibilityVersion = "Xcode 13.0";
174 | developmentRegion = en;
175 | hasScannedForEncodings = 0;
176 | knownRegions = (
177 | en,
178 | Base,
179 | );
180 | mainGroup = 84A074B027E9B68400EF4821;
181 | productRefGroup = 84A074BA27E9B68500EF4821 /* Products */;
182 | projectDirPath = "";
183 | projectRoot = "";
184 | targets = (
185 | 84A074B827E9B68500EF4821 /* BanScreenshotDemo */,
186 | );
187 | };
188 | /* End PBXProject section */
189 |
190 | /* Begin PBXResourcesBuildPhase section */
191 | 84A074B727E9B68500EF4821 /* Resources */ = {
192 | isa = PBXResourcesBuildPhase;
193 | buildActionMask = 2147483647;
194 | files = (
195 | 84A074D827E9B6D500EF4821 /* 123.jpg in Resources */,
196 | 84A074CC27E9B68600EF4821 /* LaunchScreen.storyboard in Resources */,
197 | 84A074C927E9B68600EF4821 /* Assets.xcassets in Resources */,
198 | 84A074C727E9B68500EF4821 /* Main.storyboard in Resources */,
199 | );
200 | runOnlyForDeploymentPostprocessing = 0;
201 | };
202 | /* End PBXResourcesBuildPhase section */
203 |
204 | /* Begin PBXShellScriptBuildPhase section */
205 | F38D64029E188CF877C4C1E4 /* [CP] Check Pods Manifest.lock */ = {
206 | isa = PBXShellScriptBuildPhase;
207 | buildActionMask = 2147483647;
208 | files = (
209 | );
210 | inputFileListPaths = (
211 | );
212 | inputPaths = (
213 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
214 | "${PODS_ROOT}/Manifest.lock",
215 | );
216 | name = "[CP] Check Pods Manifest.lock";
217 | outputFileListPaths = (
218 | );
219 | outputPaths = (
220 | "$(DERIVED_FILE_DIR)/Pods-BanScreenshotDemo-checkManifestLockResult.txt",
221 | );
222 | runOnlyForDeploymentPostprocessing = 0;
223 | shellPath = /bin/sh;
224 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
225 | showEnvVarsInLog = 0;
226 | };
227 | FE0DFFAE435D28DBE8572250 /* [CP] Embed Pods Frameworks */ = {
228 | isa = PBXShellScriptBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | );
232 | inputFileListPaths = (
233 | "${PODS_ROOT}/Target Support Files/Pods-BanScreenshotDemo/Pods-BanScreenshotDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
234 | );
235 | name = "[CP] Embed Pods Frameworks";
236 | outputFileListPaths = (
237 | "${PODS_ROOT}/Target Support Files/Pods-BanScreenshotDemo/Pods-BanScreenshotDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
238 | );
239 | runOnlyForDeploymentPostprocessing = 0;
240 | shellPath = /bin/sh;
241 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BanScreenshotDemo/Pods-BanScreenshotDemo-frameworks.sh\"\n";
242 | showEnvVarsInLog = 0;
243 | };
244 | /* End PBXShellScriptBuildPhase section */
245 |
246 | /* Begin PBXSourcesBuildPhase section */
247 | 84A074B527E9B68500EF4821 /* Sources */ = {
248 | isa = PBXSourcesBuildPhase;
249 | buildActionMask = 2147483647;
250 | files = (
251 | 8415FFE927E9C1150035EB9D /* ViewController2.m in Sources */,
252 | 84C03FB72808138100FE89BD /* ViewController4.m in Sources */,
253 | 8415FFE327E9BB730035EB9D /* ViewController1.m in Sources */,
254 | 84A074C427E9B68500EF4821 /* ViewController.m in Sources */,
255 | 849297C527EC3F0900FD9A76 /* MAScreenShieldView.m in Sources */,
256 | 8415FFE627E9BF5B0035EB9D /* BaseViewController.m in Sources */,
257 | 84A074BE27E9B68500EF4821 /* AppDelegate.m in Sources */,
258 | 8415FFEC27E9CAE10035EB9D /* ViewController3.m in Sources */,
259 | 84C03FBA2808165600FE89BD /* ViewController5.m in Sources */,
260 | 84A074CF27E9B68600EF4821 /* main.m in Sources */,
261 | );
262 | runOnlyForDeploymentPostprocessing = 0;
263 | };
264 | /* End PBXSourcesBuildPhase section */
265 |
266 | /* Begin PBXVariantGroup section */
267 | 84A074C527E9B68500EF4821 /* Main.storyboard */ = {
268 | isa = PBXVariantGroup;
269 | children = (
270 | 84A074C627E9B68500EF4821 /* Base */,
271 | );
272 | name = Main.storyboard;
273 | sourceTree = "";
274 | };
275 | 84A074CA27E9B68600EF4821 /* LaunchScreen.storyboard */ = {
276 | isa = PBXVariantGroup;
277 | children = (
278 | 84A074CB27E9B68600EF4821 /* Base */,
279 | );
280 | name = LaunchScreen.storyboard;
281 | sourceTree = "";
282 | };
283 | /* End PBXVariantGroup section */
284 |
285 | /* Begin XCBuildConfiguration section */
286 | 84A074D027E9B68600EF4821 /* Debug */ = {
287 | isa = XCBuildConfiguration;
288 | buildSettings = {
289 | ALWAYS_SEARCH_USER_PATHS = NO;
290 | CLANG_ANALYZER_NONNULL = YES;
291 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
293 | CLANG_ENABLE_MODULES = YES;
294 | CLANG_ENABLE_OBJC_ARC = YES;
295 | CLANG_ENABLE_OBJC_WEAK = YES;
296 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
297 | CLANG_WARN_BOOL_CONVERSION = YES;
298 | CLANG_WARN_COMMA = YES;
299 | CLANG_WARN_CONSTANT_CONVERSION = YES;
300 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
302 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
303 | CLANG_WARN_EMPTY_BODY = YES;
304 | CLANG_WARN_ENUM_CONVERSION = YES;
305 | CLANG_WARN_INFINITE_RECURSION = YES;
306 | CLANG_WARN_INT_CONVERSION = YES;
307 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
308 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
309 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
311 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
312 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
313 | CLANG_WARN_STRICT_PROTOTYPES = YES;
314 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
315 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
316 | CLANG_WARN_UNREACHABLE_CODE = YES;
317 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
318 | COPY_PHASE_STRIP = NO;
319 | DEBUG_INFORMATION_FORMAT = dwarf;
320 | ENABLE_STRICT_OBJC_MSGSEND = YES;
321 | ENABLE_TESTABILITY = YES;
322 | GCC_C_LANGUAGE_STANDARD = gnu11;
323 | GCC_DYNAMIC_NO_PIC = NO;
324 | GCC_NO_COMMON_BLOCKS = YES;
325 | GCC_OPTIMIZATION_LEVEL = 0;
326 | GCC_PREPROCESSOR_DEFINITIONS = (
327 | "DEBUG=1",
328 | "$(inherited)",
329 | );
330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
332 | GCC_WARN_UNDECLARED_SELECTOR = YES;
333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
334 | GCC_WARN_UNUSED_FUNCTION = YES;
335 | GCC_WARN_UNUSED_VARIABLE = YES;
336 | IPHONEOS_DEPLOYMENT_TARGET = 15.4;
337 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
338 | MTL_FAST_MATH = YES;
339 | ONLY_ACTIVE_ARCH = YES;
340 | SDKROOT = iphoneos;
341 | };
342 | name = Debug;
343 | };
344 | 84A074D127E9B68600EF4821 /* Release */ = {
345 | isa = XCBuildConfiguration;
346 | buildSettings = {
347 | ALWAYS_SEARCH_USER_PATHS = NO;
348 | CLANG_ANALYZER_NONNULL = YES;
349 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
350 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
351 | CLANG_ENABLE_MODULES = YES;
352 | CLANG_ENABLE_OBJC_ARC = YES;
353 | CLANG_ENABLE_OBJC_WEAK = YES;
354 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
355 | CLANG_WARN_BOOL_CONVERSION = YES;
356 | CLANG_WARN_COMMA = YES;
357 | CLANG_WARN_CONSTANT_CONVERSION = YES;
358 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
359 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
360 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
361 | CLANG_WARN_EMPTY_BODY = YES;
362 | CLANG_WARN_ENUM_CONVERSION = YES;
363 | CLANG_WARN_INFINITE_RECURSION = YES;
364 | CLANG_WARN_INT_CONVERSION = YES;
365 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
366 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
367 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
368 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
369 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
370 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
371 | CLANG_WARN_STRICT_PROTOTYPES = YES;
372 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
373 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
374 | CLANG_WARN_UNREACHABLE_CODE = YES;
375 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
376 | COPY_PHASE_STRIP = NO;
377 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
378 | ENABLE_NS_ASSERTIONS = NO;
379 | ENABLE_STRICT_OBJC_MSGSEND = YES;
380 | GCC_C_LANGUAGE_STANDARD = gnu11;
381 | GCC_NO_COMMON_BLOCKS = YES;
382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
384 | GCC_WARN_UNDECLARED_SELECTOR = YES;
385 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
386 | GCC_WARN_UNUSED_FUNCTION = YES;
387 | GCC_WARN_UNUSED_VARIABLE = YES;
388 | IPHONEOS_DEPLOYMENT_TARGET = 15.4;
389 | MTL_ENABLE_DEBUG_INFO = NO;
390 | MTL_FAST_MATH = YES;
391 | SDKROOT = iphoneos;
392 | VALIDATE_PRODUCT = YES;
393 | };
394 | name = Release;
395 | };
396 | 84A074D327E9B68600EF4821 /* Debug */ = {
397 | isa = XCBuildConfiguration;
398 | baseConfigurationReference = 584E99FD005967B78F832D81 /* Pods-BanScreenshotDemo.debug.xcconfig */;
399 | buildSettings = {
400 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
401 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
402 | CODE_SIGN_STYLE = Automatic;
403 | CURRENT_PROJECT_VERSION = 1;
404 | DEVELOPMENT_TEAM = "";
405 | GENERATE_INFOPLIST_FILE = YES;
406 | INFOPLIST_FILE = BanScreenshotDemo/Info.plist;
407 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
408 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
409 | INFOPLIST_KEY_UIMainStoryboardFile = Main;
410 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
411 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
412 | IPHONEOS_DEPLOYMENT_TARGET = 13.2;
413 | LD_RUNPATH_SEARCH_PATHS = (
414 | "$(inherited)",
415 | "@executable_path/Frameworks",
416 | );
417 | MARKETING_VERSION = 1.0;
418 | PRODUCT_BUNDLE_IDENTIFIER = com.qq.demo.BanScreenshotDemo;
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | SWIFT_EMIT_LOC_STRINGS = YES;
421 | TARGETED_DEVICE_FAMILY = "1,2";
422 | };
423 | name = Debug;
424 | };
425 | 84A074D427E9B68600EF4821 /* Release */ = {
426 | isa = XCBuildConfiguration;
427 | baseConfigurationReference = 2AEB140A2ABDB1FC8C35F3E2 /* Pods-BanScreenshotDemo.release.xcconfig */;
428 | buildSettings = {
429 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
430 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
431 | CODE_SIGN_STYLE = Automatic;
432 | CURRENT_PROJECT_VERSION = 1;
433 | DEVELOPMENT_TEAM = "";
434 | GENERATE_INFOPLIST_FILE = YES;
435 | INFOPLIST_FILE = BanScreenshotDemo/Info.plist;
436 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
437 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
438 | INFOPLIST_KEY_UIMainStoryboardFile = Main;
439 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
440 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
441 | IPHONEOS_DEPLOYMENT_TARGET = 13.2;
442 | LD_RUNPATH_SEARCH_PATHS = (
443 | "$(inherited)",
444 | "@executable_path/Frameworks",
445 | );
446 | MARKETING_VERSION = 1.0;
447 | PRODUCT_BUNDLE_IDENTIFIER = com.qq.demo.BanScreenshotDemo;
448 | PRODUCT_NAME = "$(TARGET_NAME)";
449 | SWIFT_EMIT_LOC_STRINGS = YES;
450 | TARGETED_DEVICE_FAMILY = "1,2";
451 | };
452 | name = Release;
453 | };
454 | /* End XCBuildConfiguration section */
455 |
456 | /* Begin XCConfigurationList section */
457 | 84A074B427E9B68400EF4821 /* Build configuration list for PBXProject "BanScreenshotDemo" */ = {
458 | isa = XCConfigurationList;
459 | buildConfigurations = (
460 | 84A074D027E9B68600EF4821 /* Debug */,
461 | 84A074D127E9B68600EF4821 /* Release */,
462 | );
463 | defaultConfigurationIsVisible = 0;
464 | defaultConfigurationName = Release;
465 | };
466 | 84A074D227E9B68600EF4821 /* Build configuration list for PBXNativeTarget "BanScreenshotDemo" */ = {
467 | isa = XCConfigurationList;
468 | buildConfigurations = (
469 | 84A074D327E9B68600EF4821 /* Debug */,
470 | 84A074D427E9B68600EF4821 /* Release */,
471 | );
472 | defaultConfigurationIsVisible = 0;
473 | defaultConfigurationName = Release;
474 | };
475 | /* End XCConfigurationList section */
476 | };
477 | rootObject = 84A074B127E9B68400EF4821 /* Project object */;
478 | }
479 |
--------------------------------------------------------------------------------