YSHYAssetsPickerDemo 介绍
YSHYAssetPickerController *picker = [[YSHYAssetPickerController alloc]initWithNumber:5 andHasSelectedImags:dataSource];//最多只能选5张 并传入已经选好的图片数组 picker.assetsFilter = [ALAssetsFilter allPhotos]; picker.showEmptyGroups = NO; picker.pickerDelegate = self; picker.selectionFilter = [nspredicate predicateWithBlock:^BOOL(id evaluatedobject,NSDictionary *bindings){ if ([[(ALAsset *)evaluatedobject valueForProperty:ALAssetPropertyType]isEqual:ALAssetTypeVideo]) { NSTimeInterval duration = [[(ALAsset *)evaluatedobject valueForProperty:ALAssetPropertyDuration]doubleValue]; return duration >= 5; }else{ return YES; } }]; [self presentViewController:picker animated:YES completion:^{ }];
实现其代理方法:
-(void)assetPickerController:(YSHYAssetPickerController )picker didFinishPickingAssets:(NSArray )assets {
[dataSource removeAllObjects]; [dataSource addobjectsFromArray:assets]; [self CreatimageViewWithImags:dataSource];
}