alassetslibrary

FIlter alassets by year

十年热恋 提交于 2019-12-08 08:00:02
问题 I'm trying to filter AlAssets by year and month. I can already get the dates and filter by year and month, but it's too slow with about 1000 photos. What's the best way to do it? + (void) loadFromLibraryByDate:(ALAssetsLibrary *)library assetType:(NSString *)type toArray:(NSMutableArray *)array onTable:(UITableView *)tableView onYear:(NSString *)year onMonth:(NSString *)mouth withDelegate:(id) delegate{ //clean passed objects [array removeAllObjects]; // filter for the library NSInteger

display all videos stored in document directory

ぐ巨炮叔叔 提交于 2019-12-08 04:22:05
问题 I stored videos in my document directory from photo library. Now i want to show all videos which are stored in my document directory.. but i don't know how its possible??? Actually i want to display all videos as like its open in photo library(four videos in a single row).. and when i click on any video... the video is start playing... can anybody help me which is the best way to show all videos from document directory to ViewController.... Thanx...... - (void) imagePickerController:

Find out when my asynchronous call is finished

白昼怎懂夜的黑 提交于 2019-12-08 02:08:21
问题 I iterate through a list of photo albums on a iOS device. After having iterated through this group I want to simply print out the number of albums that were found. What do I have to change in my code that the NSLog statement is only executed, when all the albums were loaded. ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; NSMutableArray *tempArray = [[NSMutableArray alloc] init]; void (^groupBlock)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop){ if (group == nil)

Copy image from assets-library to an app folder

点点圈 提交于 2019-12-08 00:31:18
问题 I have an UIImagePickerController and I would like to save a selected image to my app. I can do that easy by getting the current UIImage and save it (by creating a file) but I would prefer to directly copy the file from Library to my folder. So now I have an URL of the selected image : UIImagePickerControllerReferenceURL which return a specific pattern "assets-library". I tried to copy an image from this kind of URL to a path but without success. Is there a way to success on what I would like

How to get a low res image, or Thumbnail from the ALAssetRepresentation in Swift

孤街浪徒 提交于 2019-12-07 05:28:30
问题 I am working with the ALAssetLibrary to get the images from my camera roll for a custom view I am making. Doing so was pretty simple: library.enumerateGroupsWithTypes(ALAssetsGroupType(ALAssetsGroupSavedPhotos), usingBlock: { (group: ALAssetsGroup?, stop: UnsafeMutablePointer<ObjCBool>) in if group != nil { group!.setAssetsFilter(ALAssetsFilter.allPhotos()) var indexSet = NSIndexSet(indexesInRange: NSMakeRange(0, group!.numberOfAssets() - 1)) group!.enumerateAssetsAtIndexes(indexSet, options:

How to move an image from asset library to an application specific private location?

瘦欲@ 提交于 2019-12-07 04:23:27
问题 Here is the code snippet i tried: [library writeImageToSavedPhotosAlbum:self.checkInImage.CGImage metadata:self.metadata completionBlock :^(NSURL * assetURL, NSError * error) { NSLog (@"Asset url = %@", assetURL); NSError *err; NSString *docDir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *jpgFilePath = [NSString stringWithFormat:@"%@/test.jpg", docDir]; NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager

How to display video from ALAsset to UICollectionview ios

痴心易碎 提交于 2019-12-07 02:48:05
问题 I tried below code to get all videos from photo library by using ALAsset . For now, i want to display all videos to a UICollectionview but it doesn't seem to display anything. Please give me some advice. Thanks in advance. -ViewDidLoad() : get all videos from Photo Library allVideos = [[NSMutableArray alloc] init]; ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init]; [assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if (group)

UIImagePickerControllerOriginalImage vs original asset data

梦想的初衷 提交于 2019-12-06 22:43:08
问题 In the app that I am developing, I am using an image that a user chooses from their photo albums. I need to upload a hi-res version of that photo to my server. I'm using imagePickerController and I've determined that I have 2 options use UIImage from UIImagePickerControllerOriginalImage get original asset by using UIImagePickerControllerReferenceURL and ALAssetsLibrary assetForURL (I don't like this because it prompts the user to use their current location, which I don't need) My question is.

display all videos stored in document directory

☆樱花仙子☆ 提交于 2019-12-06 16:35:36
I stored videos in my document directory from photo library. Now i want to show all videos which are stored in my document directory.. but i don't know how its possible??? Actually i want to display all videos as like its open in photo library(four videos in a single row).. and when i click on any video... the video is start playing... can anybody help me which is the best way to show all videos from document directory to ViewController.... Thanx...... - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSURL * movieURL = [info

Copy image from assets-library to an app folder

≡放荡痞女 提交于 2019-12-06 14:15:55
I have an UIImagePickerController and I would like to save a selected image to my app. I can do that easy by getting the current UIImage and save it (by creating a file) but I would prefer to directly copy the file from Library to my folder. So now I have an URL of the selected image : UIImagePickerControllerReferenceURL which return a specific pattern "assets-library". I tried to copy an image from this kind of URL to a path but without success. Is there a way to success on what I would like to do ? Thanks ! Shamsudheen TK You can do it through two ways First Way: Using imagePickerController