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;
    }
    

      

  • 相关阅读:
    nexus3.x Liunx私库安装教程 (亲测有用)
    nexus 3.x下载 3.18.1(maven 私服)
    halo项目源码本地部署解决方案
    gradle的安装配置
    raw.githubusercontent.com 访问不了
    springboot使用quartz解决调用不到spring注入service的问题
    Linux在不能使用yum的环境下安装pgsql(公司内网)
    idea 里面的maven依赖下载不了,以及mabtis依赖包错误
    关于oracle 数据库效率的优化
    关于oracle 不常用的job 运行时间设置
  • 原文地址:https://www.cnblogs.com/tomblogblog/p/6338081.html
Copyright © 2011-2022 走看看