I am new in iPhone and in learning phase now a days. Actually i want to implement that i read images stored in my iPhone PHOTO Gallery and then display it onto my application.
I have searched in many Search Engines but could not find any thing. You all are professionals over here. Please guide me thrrough some code or some tutorial.
Thanks alot
Edit
Also check out this question/answer and the method that is used to get the image from uiimagepickercontroller
as the method that i have mentioned earlier is deprecated.
didFinishPickingMediaWithInfo return nil photo
check out the documentation http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html and check out this link
http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/
It has sample examples about the same.
You can use these methods to get the image in you UIImageView object
- (void)selectPhotos
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
//Deprecated In IOS6[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
imageView.image = image;
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
You can access the iPhone image library like this and select the image from there
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
if (picker == nil) {
picker = [[UIImagePickerController alloc] init];
picker.allowsEditing = NO;
}
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
// Make camera view full screen:
picker.wantsFullScreenLayout = YES;
[self.navigationController presentModalViewController:picker animated:YES];
}
And then implement the delegate method to get the image...
- (void)imagePickerController:(UIImagePickerController *)picker1 didFinishPickingMediaWithInfo:(NSDictionary *)info
{
cameraClickedImage=[info valueForKey:UIImagePickerControllerOriginalImage];
UIImage *thumbImage = [cameraClickedImage imageByScalingAndCroppingForSize:CGSizeMake(320, 480)];
clickedImageView.image =thumbImage;
[picker1 dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker1 {
NSLog(@"Cap1");
[picker1 dismissModalViewControllerAnimated:YES];
[self.navigationController popViewControllerAnimated:NO];
}
Hope this will help you.......... Cheers......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With