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];
Related
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 using an UIImagePickerController with sourceType = UIImagePickerControllerSourceTypeCamera;
However I want to specify that I want to take only photos, not videos , (in a native camera user can switch to video) is there a way to do so ?
Here is the code I am using :
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO))
return ;
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
// Displays a control that allows the user to choose picture or
// movie capture, if both are available:
cameraUI.mediaTypes =
[UIImagePickerController availableMediaTypesForSourceType:
UIImagePickerControllerSourceTypeCamera];
// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;
cameraUI.delegate = self;
[self presentViewController:cameraUI animated:YES completion:nil];
My 1st guess was is to change the sourceType = UIImagePickerControllerSourceTypeCamera; but the other options are galleries options.
My 2nd guess is: to change the array of mediaTypes but I don't know to which 1
https://developer.apple.com/library/ios/documentation/uikit/reference/uiimagepickercontroller_class/index.html#//apple_ref/c/tdef/UIImagePickerControllerCameraCaptureMode
cameraUI.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
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
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 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