How to access a saved photo inside simulator on IOS 7 - ios

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.

Related

Get all GIF images saved on iPhone/iPad camera roll

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

ios open camera image from roll

I´m creating an app that access to the Camera roll using ImagePickerController. The app has a buttom and when I tap on it the app should go to the last image saved on the roll. Using that code:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated: YES];
the app open the thumbnails and I would like to open a specific image (full screen)
Is possible?
Image will open in full view only if you want to make edit to it.
Add this line to open in full view before presenting .
[picker setAllowsEditing:YES];
If you wish more function than you have two option.
Use your own custom control.
Add overlay view on UIImagePickerController
Refer this example to create your controls:
DLCImagePickerController
AGImagePickerController

open gallery with videos AND photos in iOS

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

UImagePicker select image from gallery , how scroll the gallery to the bottom?

I have UIimagePicker that get the image from the gallery ,
but I noticed that when the app open the gallery,
the gallery open and start showing the images from the top of the gallery which is the oldest images in the iphone.
My question is how to scroll the gallery to the bottom to show the newest images first as I saw in the Facebook app when uploading image from the gallery .
I used the following code to do that and it works for me :
UIImagePickerController *picker;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}

iPad2 camera display not showing

I have an iPhone app that displays the camera using UIImagePicker to take a picture. I am porting it to iPad2 and when i want to display the camera (through a modalviewcontroller) i get the camera buttons but the display in the preview is just white. If i take the picture i can see it.
Does this happen to you?
I am experiencing the same problem. I moved the UIImagePicker code to my rootviewcontroller, and it worked. I could see what was actually through the viewfinder. It also worked via a popover in the existing viewcontroller (called next after the rootviewcontroller), but the resolution was poor when I displayed the photo. This is not satisfactory, but I guess I found a workaround if absolutely necessary.
Yesterday only i have tried this code to use camera to take pics. from my app and it worked on iphone after porting it.
I think you need to call takePicture method on the controller.
Just a guess.
if([UIImagePickerController isSourceTypeAvailable:sourceType])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
if(sourceType == UIImagePickerControllerSourceTypeCamera)
[picker takePicture];
[self presentModalViewController:picker animated:YES];
[picker release];
}

Resources