How can I view an image from an iPhone image library?

I am new to ios development. I am making a photo cropping application.

I want to view the image from the iPhone image library by clicking the browse button (which I added in my application) and upload to UIImageview, which I posted in the view.

How can I view the image ?.

Can I view the full memory of the phone? (Also like asp: FileUpload).

Is there any control available on the iPhone for use in the same way as asp: FileUpload?

Thanks in advance.

+7
source share
2 answers

Super easy to do!

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [imagePicker setDelegate:self]; [self presentModalViewController:imagePicker animated:YES]; 

and

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; [picker release]; // Edited image works great (if you allowed editing) //myUIImageView.image = [info objectForKey:UIImagePickerControllerEditedImage]; // AND the original image works great //myUIImageView.image = [info objectForKey:UIImagePickerControllerOriginalImage]; // AND do whatever you want with it, (NSDictionary *)info is fine now //UIImage *myImage = [info objectForKey:UIImagePickerControllerEditedImage]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; [customImageView setImage:image]; customImageView.contentMode = UIViewContentModeScaleAspectFill; } 

got this code from stackoverflow, didn't save the url, sorry.

+9
source

The entire file system is not available if you are using a non-jailbroken phone. There are also no file system browser controls (for the same reason). However, you can browse the user's photo library or even take pictures with the camera using the UIImagePickerController. Docs: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

0
source

All Articles