zoukankan      html  css  js  c++  java
  • iOS开发之截屏分享功能

    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、对图片进行存储本地或者服务器进行分享操作

  • 相关阅读:
    spark 中划分stage的思路
    如何带人
    技术管理
    学会谈判
    绩效评估与绩效反馈
    企业文化如何落地
    绩效沟通的best原则
    Area POJ
    Cows POJ
    Grandpa's Estate POJ
  • 原文地址:https://www.cnblogs.com/hecanlin/p/12856275.html
Copyright © 2011-2022 走看看