I am using following code to present UIImagePickerController.For some particular scenario I want only videos.And using the following code.
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
imagePickerController.allowsEditing=NO;
imagePickerController.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie,nil];
[self presentViewController:imagePickerController animated:YES completion:nil];
But it showing Camera Roll,My Photo Stream and Videos in a tableview.If I open any folder the contents are only videos.I want Only Videos how can I achieve this.Also the title Photos,I want to change that also toVideos.
Swift 3 update :
let videoPicker = UIImagePickerController()
videoPicker.delegate = self
videoPicker.sourceType = .photoLibrary
videoPicker.mediaTypes = [kUTTypeMovie as String]
self.present(videoPicker, animated: true, completion: nil)
Import import MobileCoreServices and add delegates UIImagePickerControllerDelegate and UINavigationControllerDelegate in the top
The presented modal will have "Photos" title. You can change it like this :
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
viewController.navigationItem.title = "Choose Video"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With