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

      

  • 相关阅读:
    水晶报表 注册码
    黑马孕育期盘口的技术辨识(转贴)
    如何判断庄家出货(转贴)
    解决方案:用户 'sa' 登录失败。原因: 未与信任 SQL Server 连接相关联。
    水晶报表学习资料
    (网上收集)asp.net页面打印问题?
    arcgis地理配准第二种方法:利用已知控制点 (Spatial Adjustment和Georeferencing的区别)
    Vue父子组件之间通信
    Vue怎么引用组件和使用组件?
    ESLint:error 'reject' is defined but never used nounusedvars
  • 原文地址:https://www.cnblogs.com/tomblogblog/p/6338081.html
Copyright © 2011-2022 走看看