zoukankan      html  css  js  c++  java
  • iOS View快照,View截屏

    #pragma mark - 屏幕快照
     
    - (UIImage *)convertViewToImage:(UIView *)view
    {
        //https://github.com/alskipp/ASScreenRecorder 录屏代码
        // 第二个参数表示是否非透明。如果需要显示半透明效果,需传NO,否则YES。第三个参数就是屏幕密度了
        UIGraphicsBeginImageContextWithOptions(view.bounds.size,YES,[UIScreen mainScreen].scale);
        [view.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return image;
    }
     
    - (UIImage *)snapsHotView:(UIView *)view
    {
        UIGraphicsBeginImageContextWithOptions(view.bounds.size,YES,[UIScreen mainScreen].scale);
        [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return image;
    }
    

      

  • 相关阅读:
    JNDI技术扩展
    多数据源配置
    单数据源配置
    配置文件初始化异常Configuration system failed to initialize
    控制台应用程序中托管Web API 1.0,不需要IIS。
    WPF界面卡顿简要分析和处理
    异常System.AccessViolationException的处理方式
    logstash 启动报错
    常用命令总结
    mac 安装kafka扩展
  • 原文地址:https://www.cnblogs.com/tomblogblog/p/6338081.html
Copyright © 2011-2022 走看看