我想知道怎麼了如何使用URL檢索圖像URL檢索圖像。我正在使用ALAsset。我遵循了以下鏈接display image from URL retrieved from ALAsset in iPhone的答案(帶勾號的那個)。如何檢索圖片並上傳?iPhone上使用使用ALAsset
6
A
回答
16
有你設法讓ALAsset?一旦你這樣做,獲得圖像很容易。要獲取縮略圖,資產有一個方法...縮略圖。
UIImage *img = [UIImage imageWithCGImage:[myAsset thumbnail]];
爲了讓你不得不通過默認表示了充分水庫圖像。
UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullResolutionImage]
希望這有助於
3
我知道這是一個老問題,但爲了以防萬一別人來了,我發現了另一個方法(需要iOS 5+),返回一個更易於使用的圖像的工作:
UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation]
fullScreenImage];
從fullScreenImage
文檔:
在iOS 5中和以後,此方法返回一個完全裁剪,旋轉和調整後的圖像,準確地爲用戶將看到的照片或圖片選擇器。
monkybonk05的答案的工作,但它不會被裁剪或旋轉。
2
退房這種方法
+ (UIImage *)imageFromAsset:(ALAsset *)asset
{
ALAssetRepresentation *representation = [asset defaultRepresentation];
return [UIImage imageWithCGImage:representation.fullResolutionImage
scale:[representation scale]
orientation:(UIImageOrientation)[representation orientation]];
}
我略作調整,但在此基礎上依據:https://gist.github.com/NR4TR/8576048
相關問題
- 1. 顯示的ALAsset使用QLPreviewController
- 2. 使用ALAsset從GRKPhoto UIImage
- 3. 無法上傳文件(使用ALAsset庫)到Dropbox使用Dropbox API
- 4. 使用iPhone上
- 5. 在iPhone上使用
- 6. 使用UIVideoEditorController修剪ALAsset視頻
- 7. 如何使用ALAsset URL在MPMoviePlayerController上播放視頻?
- 8. NSBlockOperation或NSOperation with ALAsset Block使用ALAsset顯示照片庫圖像URL
- 9. 在上傳之前在iPhone上壓縮/調整ALAsset視頻
- 10. 在iPhone SDK上使用setApplicationBadgeString
- 11. 在iPhone,iPad上使用Regexkitlite
- 12. 在iPhone上使用sqlite3_create_collation
- 13. 在iPhone上使用SecKeyRawSign
- 14. 在iphone上使用actionscripts
- 15. 從MessageUI使用MFMailComposeViewController iPhone上
- 16. 在iPhone上使用boost
- 17. 在iPhone上使用GL_UNSIGNED_SHORT_1_5_5_5_REV
- 18. 在iPhone上使用kAudioSessionProperty_OtherMixableAudioShouldDuck
- 19. 使用innerHTML的iPhone上
- 20. 在iPhone上使用語言
- 21. 在iphone上使用xmpp ..?
- 22. 在iPhone上使用iTunes
- 23. 我不能在iPhone上使用破折號在iphone上使用libxml2
- 24. 使用iPhone API與iPhone Iphone
- 25. iphone:使用ASIFormDataRequest
- 26. iphone - Tabbar使用
- 27. 使用iPhone
- 28. iPhone:使用NSDateFormatter
- 29. 使用AVMutableComposition iPhone
- 30. 使用wsdl2Objc(IPhone)
感謝它爲我工作 – Leena 2011-11-25 05:18:16