本文转自http://blog.csdn.net/toddmi/article/details/8204102
[html] view
plaincopy
- = (NSCachesDirectory, NSUserDomainMask, YES);
- = [cachePaths objectAtIndex:0];
- }
[html] view
plaincopy
- = (NSCachesDirectory, NSUserDomainMask, YES);
- = [cachePaths objectAtIndex:0];
- }
[html] view
plaincopy
- = (dirName);
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
- = ;
- == YES && == YES) )
- = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
- = (dirName);
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
- = ;
- == YES && == YES )
- = [fileManager removeItemAtPath:imageDir error:nil];
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
- = ;
- == YES && == YES )
- = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
- = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
- == YES && == YES )
- = [directoryPath stringByAppendingString : imageName];
- = [fileManager fileExistsAtPath:imagePath];
- = [NSData dataWithContentsOfFile : imagePath];
[html] view
plaincopy
- = (dirName);
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
- = ;
- == YES && == YES) )
- = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
- = (dirName);
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
- = ;
- == YES && == YES )
- = [fileManager removeItemAtPath:imageDir error:nil];
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
- = ;
- == YES && == YES )
- = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
- = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
- = ;
- = [NSFileManager defaultManager];
- = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
- == YES && == YES )
- = [directoryPath stringByAppendingString : imageName];
- = [fileManager fileExistsAtPath:imagePath];
- = [NSData dataWithContentsOfFile : imagePath];
时间: 2024-10-12 09:05:27