0
A
回答
2
是的,你可以。
// Save image to disk
NSString *documentaryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/Image.png",documentaryPath];
NSData *data = [NSData dataWithData:UIImagePNGRepresentation(YOUR_IMAGE)];
[data writeToFile:filePath atomically:YES];
// Retrieve the Image
- (NSData *) imageData {
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/Image.png",docDir];
NSData *dataImage = [NSData dataWithContentsOfFile:pngFilePath];
return dataImage;
}
後來
UIImage *image = [UIImage imageWithData:imageData]
1
是的,這是可能的。
您必須下載並保存每個接收到的圖像到應用程序目錄中,然後在CoreData中保存這些圖像的路徑。
相關問題
- 1. 捕獲手機後保存圖像ios
- 2. iOS保存組合圖像
- 3. 在iOS中保存圖像
- 4. 相機不保存圖像
- 5. 畢加索爲什麼不保存圖像緩存供脫機使用?
- 6. React Native將圖像保存到iOS相機膠捲
- 7. 將圖像保存到默認相機文件夾 - IOS
- 8. 加載在iOS中保存的圖像
- 9. 在保存iOS之前旋轉圖像
- 10. IOS用名稱保存圖像
- 11. 保存並檢索圖像 - Ios
- 12. 從相機保存縮放圖像
- 13. 將圖像保存到手機? WP7 C#
- 14. 保存圖像在本地計算機
- 15. 保存圖像在相機活動
- 16. 機器人:取攝像機圖像無「保存」 /「刪除」確認
- 17. 保存具有兩個圖像的兩個UIImageView圖像 - ios
- 18. 從NSDocumentDirectory保存和訪問圖像的iOS圖像
- 19. 保存圖像
- 20. 保存圖像
- 21. 保存圖像
- 22. 保存圖像
- 23. phonegap與圖像脫機同步
- 24. 與脫機存儲
- 25. 如何使用通用圖像加載器脫機緩存?
- 26. 用相機保存圖像疊加拍攝的圖像underneith
- 27. iOS的PhoneGap相機無法保存圖片到圖片庫
- 28. iphone圖像保存
- 29. 保存圖像Doctrine2
- 30. iOS-保存視圖屬性
是的,你可以保存圖像文件目錄並保存在coredata路徑。其他選項是你可以使用[SDWebImage](https://github.com/rs/SDWebImage)它會下載鏡像並緩存它。 – 2014-10-22 08:01:04