簡單的經過NSFileManager 存儲圖片

UIImage *image = [UIImage imageNamed:@"Default.png"];
    NSData *data = UIImageJPEGRepresentation(image,0.7);
    NSArray  *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentDirectory = [paths objectAtIndex:0];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *fullPath = [documentDirectory stringByAppendingFormat:@"/de.png"];
    [fileManager createFileAtPath:fullPath contents:data attributes:nil];
相關文章
相關標籤/搜索