I have seen other apps do it where you can import the last photo from the Photos app for quick use but as far as I know, I only know how to get A image and not the last (most recent one). Can anyone show me how to get the last image?
相关问题
- Views base64 encoded blob in HTML with PHP
- How to get the background from multiple images by
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Use savefig in Python with string and iterative in
- Where does a host app handle NSExtensionContext#co
- Where does this quality loss on Images come from?
- Swift - hide pickerView after value selected
- Specifying image dimensions in HTML vs CSS for pag
Building upon iBrad's answer, here's a quick & dirty Swift version that works for me in iOS 8.1:
Note: this requires iOS 8.0+. Be sure to link the Photos framework and add "import Photos" in your file.
The following code works with iOS7 and iOS8. It also checks if there is an image in the filter. Before you execute the code you should check the album permission:
(This code is a modified version from here.)
Thanks for your answer iBrad Apps.
Just wanted to point out an error prevention for the special case when user has no images on his/her photo roll (strange case I know):
Well, here is a solution of how to load last image from gallery with Swift 3 guys:
If you need more speed, you can also use
PHImageRequestOptions
and set those:And this is the way you get it in your viewController (you should replace GalleryManager.manager with your class):
Xamarin.iOS version of accepted answer (how to get last image) including all notices from other answers:
This code snippet will get the latest image from the camera roll (iOS 7 and below):
iOS 8 and above: