//第一步:保存头像信息到NSData中

   NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);  
   self.documentsPath = [paths objectAtIndex:0];  

NSString *imagePath = [NSString stringWithFormat:@"%@/%@.jpg", self.documentsPath, contacts.Photo];
UIImage *tempImage = [UIImage imageWithContentsOfFile:imagePath];
headOldImageData = [NSData dataWithData:UIImageJPEGRepresentation(tempImage, 1.0)];
[headOldImageData retain];

 

//第二步:修改后用writeToFile归档

    NSString *imagePath = [NSString stringWithFormat:@"%@/%@.jpg", self.documentsPath, oldImageName];  
    

if([fileManager fileExistsAtPath:imagePath]) { [headOldImageData writeToFile:[NSString stringWithFormat:@"%@/%@.jpg", self.documentsPath, oldImageName] atomically:YES]; }

 

相关文章:

  • 2022-03-03
  • 2021-12-26
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-24
  • 2022-02-10
  • 2022-12-23
  • 2021-09-08
  • 2021-11-30
  • 2021-10-09
相关资源
相似解决方案