1、监听系统截屏通知

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUserDidTakeScreenshotNotification:) name:UIApplicationUserDidTakeScreenshotNotification object:nil];

2、监听到截屏后获取屏幕截屏图片

UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    // 1.开启上下文
    UIGraphicsBeginImageContextWithOptions(window.bounds.size, window.opaque, 0);
    // 2.渲染
    [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:NO];
    // 3.获取图片
    UIImage *snapshotImage=UIGraphicsGetImageFromCurrentImageContext();
    // 4.结束上下文
    UIGraphicsEndImageContext();

3、对图片进行存储本地或者服务器进行分享操作

相关文章:

  • 2021-12-27
  • 2021-10-25
  • 2021-08-19
  • 2021-07-27
  • 2021-11-13
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2021-11-16
  • 2021-10-19
相关资源
相似解决方案