• iOS手机截屏使用


    1.截屏 保存 。data 
    
    //登录成功进行截屏
                //截取屏幕大小
                UIGraphicsBeginImageContext([[UIScreen mainScreen]bounds].size);
                
                [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
                
                UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
                
                UIGraphicsEndImageContext();
                
                NSData * imgdata = UIImagePNGRepresentation(image);
                if (!imgdata) {
                    
                    imgdata = UIImageJPEGRepresentation(image, 1.0);
                }
                
                [[NSUserDefaults standardUserDefaults]setObject:imgdata forKey:@"loginImage"];
                
    
    
    2。使用
    
     NSData * data = [[NSUserDefaults standardUserDefaults] objectForKey:@"loginImage"];
        UIImage * image = [UIImage imageWithData:data];
        UIImageView * imageview = [[UIImageView alloc] initWithFrame:self.view.frame];
        imageview.image = image;
        imageview.alpha = 0.6;
        [self.view addSubview:imageview];
  • 相关阅读:
    3ds
    markdown-to-html.min.js
    $interpolateProvider
    Angular 插值字符串
    Angular 手动解析表达式
    JAVA 多线程
    listFiles()
    键盘读入
    BufferedInputStream、BufferedOutputStream
    FileInputStream、FileOutputStream的应用
  • 原文地址:https://www.cnblogs.com/xujiahui/p/6548892.html
Copyright © 2020-2023  润新知