As far as I know, it is very easy to get all the videos from the Camera Roll, just by doing something like this:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentViewController:imagePicker animated:YES completion:nil];
My question is, how is it possible to get all the GIF saved on the camera roll?
I have downloaded the app 'GifBoom Pro' and it does it.
Thank you very much.
I know this is an old question. But for anyone else to come, you'll need to use the Photos framework and use requestImageDataForAsset:imageData:imageUTI,Orientation,Info and compare the image UTI against the string of com.compuserve.gif. ALAssetsLibrary will become deprecated by iOS 9.0
Related
I am working with video marge app. When i pick video from library using UIImagePicker, it is a default style like this photo.
But I want like this.
If i use ELCImagePicker i can pick video. but when i try to set the video in a video player it show null video url. Please help.
You can use mediative property of UIImagePickerController for selecting media of type video. here is sample code .
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentModalViewController:imagePicker animated:YES];
I have tried a couple of different methods for presenting a landscape-oriented UIImagePickerController in a landscape-only app (not by my choice) I'm working on.
When I (successfully) present the gallery in landscape format and scroll through the images, there is a truly horrible stutter!
The current technique I am using is this:
- (void)presentImagePickerController:(UIImagePickerControllerSourceType)sourceType {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
if (isDeviceIPad) {
picker.modalPresentationStyle = UIModalPresentationFormSheet;
picker.preferredContentSize = [UIScreen mainScreen].bounds.size;
}
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsEditing = YES;
[self presentViewController:picker
animated:YES
completion:nil];
}
I cannot go with a solution which uses private interfaces, since the app has to pass App Store review. I'd prefer not to use a third-party library, since my boss is against that idea.
My iPad is a 3rd generation, model MD334LL/A that's running iOS 8.1.
From the UIImagePickerController class reference found here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html
On iPad, the correct way to present an image picker depends on its source type, as summarized in this table:
Camera: Use full screen
Photo Library: Must use a popover
Saved Photos Album: Must use a popover
Answer: Since I want to present the Saved Photos Album, I need to present the picker by using a popover.
- (void)presentImagePickerController:(UIImagePickerControllerSourceType)sourceType {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsEditing = YES;
if (isDeviceIPad() && sourceType == UIImagePickerControllerSourceTypeSavedPhotosAlbum) {
picker.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *presentationController = picker.popoverPresentationController;
presentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
presentationController.sourceView = self.presentPickerButton;
presentationController.sourceRect = self.presentPickerButton.bounds;
}
[self presentViewController:picker
animated:YES
completion:nil];
}
i am working with an iOS application in which i want to select multiple images using UIImagepickercontroller and then upload it on DropBox.
i found in some places that by using UIImagepickercontroller we only select single image at once a time . i am using the below code for selecting multiple images using UIImagepickercontroller with the help of UIPopovercontroller :
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString*) kUTTypeImage];
// [self presentViewController: imagePicker animated:YES completion:NULL];
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[popoverController presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 300.0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
but when i run this application i only get a popup window and just select single image.
Is there any way by which i can select multiple images?
Please help me out.
Thanks in advance
There are so many third party classes which enables us to pick multiple images from asset library and all are listed here.
I suggest you to use ELCImagePickerController.
You may choose your option here.
I had drag and drop a photo inside the IOS simulator and then saved it inside Safari. This photo got saved in /Users/myuser/Library/Application Support/iPhone Simulator/7.1-64/Media/DCIM/100APPLE/IMG_0001.JPG.
When I run the app using UIImagePickerController I cannot see any photos, just the message: No Photos or Videos. You can sync photos and videos onto your iPhone using iTunes.
Is there anything different I have to do to access that photo ?
When in the simulator, go to safari, then search an image.
Long press that image and a popup will show. Choose Save Image. Now the image is saved in your saved photos album.
When in the app, open the ImagePicker like this :
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *) kUTTypeImage, nil];
[self presentViewController:picker animated:YES completion:NULL];
Be sure to include <MobileCoreServices/MobileCoreServices.h> for the mediaType (if you want photos only, without videos).
(if it's an iPad app it will be a little different, you will need to use UIPopoverController).
You should be able to see that image you saved.
Good Luck.
I was using the UIImagePickerViewController, and i wanted to open the camera roll. But, in my app, i have a button to open my camera roll and another one to open my camera. When i take a picture or record a video, obviously i wanted to see those images in my camera roll. But, in my app, when i start to record a video, he doesn't show up in my camera roll's app.
Here's a little bit of code:
UIImagePickerController *cameraRoll = [[UIImagePickerController alloc] init];
[cameraRoll setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[cameraRoll setDelegate:self];
[self presentModalViewController:cameraRoll animated:YES];
At this time i can't see my videos in my camera roll's app. Could someone help me?
You just can do like this:
if([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *picker= [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, (NSString *)kUTTypeImage, nil];
[self presentModalViewController:picker animated:YES];
}
Sets the file types you want to get on the property of the PickerViewControllerObject "mediaTypes" and you're ready.
You can found the docs types here.
Regards,
Luis