iOS doesn't give you a simple way to determine - when using the UIImagePickerController - which basic file format is for images stored in the camera frame. Apple's philosophy here is that the image should be considered as a UIImage object and that it doesnβt matter to you which file format it is.
So, since you cannot use the UIImagePickerController to filter GIF files. Here are a couple of possibilities for you:
one)
Once you select an image, you can determine which file it is. Here is an example question that asks how to determine if an image is a PNG or JPEG . As soon as the user selects the file, you will find out if it is GIF or JPEG or PNG or something else.
2)
You can convert any UIImage to a GIF file. This raises a question that points to a library that might help .
3)
You can iterate over the entire frame of the camera and convert / save these images to the application document directory as GIF files. Something that starts with the listing found in this related question , and then launches each image through the ImageIO environment to convert it to a gif file (the code for which I indicated in solution No. 2). Then you can flip your own collector.
ps your own code will not work because, as Nathan noted, GIF not a type of multimedia. This is a function that indicates the available media types:
-(IBAction)btnChooseGif:(id)sender { NSArray *availableMedia = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypePhotoLibrary]; NSLog(@"availableMedia is %@", availableMedia); UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil]; [self presentViewController:imagePicker animated:YES completion:nil]; }
Michael dautermann
source share