1and2papa / CTAssetsPickerController

iOS control that allows picking multiple photos and videos from user's photo library.
MIT License
2.15k stars 550 forks source link

Not Able to Hide Videos On Picker #212

Closed michaelmaloof closed 8 years ago

michaelmaloof commented 8 years ago

I'm fairly new to using other people's frameworks so I apologize for the rookie question. I've looked through the code, questions, and online documentation and still can't find where I'm able to prevent the Picker from showing any videos. I can hide albums of just videos but I can hide all the videos. Please help. Thanks!

bridworks commented 8 years ago
CTAssetsPickerController *picker = [[CTAssetsPickerController alloc] init];
picker.delegate = self;

NSPredicate *predicateMediaType = [NSPredicate predicateWithFormat:@"mediaType = %d",PHAssetMediaTypeImage];
NSCompoundPredicate *compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[predicateMediaType]];
picker.assetsFetchOptions = [[PHFetchOptions alloc] init];
picker.assetsFetchOptions.predicate = compoundPredicate;

[self presentViewController:picker animated:YES completion:nil];
1and2papa commented 8 years ago

@bridworks Thanks!

@michaelmaloof You might also refer to the sample code CTPhotosViewController.m. It does exactly what you are asking.

michaelmaloof commented 8 years ago

Wonderful thank you!