zoukankan      html  css  js  c++  java
  • 图片的读取

     // 图片路径
        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        
        NSString *imagePath = [path stringByAppendingPathComponent:@"iconImage.png"];
        
        /*读取入图片*/
        //因为拿到的是个路径,所以把它加载成一个data对象
        NSData *data = [NSData dataWithContentsOfFile:imagePath];

        UIImage *image = [UIImage imageWithData:data];
     
      // 图片路径
        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) lastObject];
        
        NSString *imagePath=[path stringByAppendingPathComponent:@"iconImage.png"];
        // 将图片写到Documents文件中
        [UIImagePNGRepresentation(image) writeToFile:imagePath atomically:YES
    ];
  • 相关阅读:
    3.10 Go Map哈希表
    3.9 Go Slice切片
    3.8 Go Array数组
    3.7 Go指针
    3.6 Go String型
    3.5 Go布尔型
    3.4 Go字符型
    3.3 Go浮点型
    3.2 Go整数类型
    3.1Go变量
  • 原文地址:https://www.cnblogs.com/Milo-CTO/p/3990182.html
Copyright © 2011-2022 走看看