Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Added sorting by creationDate asc and desc #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions QBImagePicker/QBAlbumsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
default:
break;
}

options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending: self.imagePickerController.sortMediaByCreationDateAscending]];

PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:assetCollection options:options];
PHImageManager *imageManager = [PHImageManager defaultManager];
Expand Down
2 changes: 2 additions & 0 deletions QBImagePicker/QBAssetsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ - (void)updateFetchRequest
default:
break;
}

options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending: self.imagePickerController.sortMediaByCreationDateAscending]];

self.fetchResult = [PHAsset fetchAssetsInAssetCollection:self.assetCollection options:options];

Expand Down
1 change: 1 addition & 0 deletions QBImagePicker/QBImagePickerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef NS_ENUM(NSUInteger, QBImagePickerMediaType) {

@property (nonatomic, copy) NSArray *assetCollectionSubtypes;
@property (nonatomic, assign) QBImagePickerMediaType mediaType;
@property (nonatomic, assign) BOOL sortMediaByCreationDateAscending;

@property (nonatomic, assign) BOOL allowsMultipleSelection;
@property (nonatomic, assign) NSUInteger minimumNumberOfSelection;
Expand Down