Q:

how to call imagepickerdelegate method two times when picking images from dirrerent button

I'm relatively new to X Code 
and 
I m working on photo collage App , when i pick image from one picker then image picker is working properly but i want to pick different images from different imagepicker then image picker is not working properly
Anyone help me solve my problem.  Here is my code
`
-(IBAction)imagepickMethod1:(id)sender
{
    imagepicker=[[UIImagePickerController alloc]init];
    imagepicker.delegate=self;
    imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagepicker animated:YES];
     button1.tag=100;
}
-(IBAction)imagepickMethod2:(id)sender
{
    imagepicker1=[[UIImagePickerController alloc]init];
    imagepicker1.delegate=self;
    imagepicker1.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagepicker1 animated:YES];

}

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    [picker dismissModalViewControllerAnimated:YES];
    imagepicker.view.hidden=YES;

        photoPreviewImageView.image=image;

}
-(void)imagePickerController1:(UIImagePickerController *)picker1 didFinishPickingImage:(UIImage *)image1 editingInfo:(NSDictionary *)editingInfo1
{
    [picker1 dismissModalViewControllerAnimated:YES];
    imagepicker.view.hidden=YES;
             photoPreviewImageView1.image=image1;

}

`

A:

//Take two imageView in your .h file
UIImageView *imgViewForFirstPicker;
UIImageView *imgViewForSecondPicker;

// Alloc these images in view did load 

imgViewForFirstPicker = [[UIImaeView allo] initWithFrame:(give your rect)];

// Similarly for second imageView and add to both in self.view

-(IBAction)imagepickMethod1:(id)sender
{
    UIImagePickerController *imagepicker=[[UIImagePickerController alloc]init];
    imagepicker.delegate=self;

    imagepicker.tag=100;
    imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagepicker animated:YES];
}
-(IBAction)imagepickMethod2:(id)sender
{
    UIImagePickerController *imagepicker1=[[UIImagePickerController alloc]init];
    imagepicker1.delegate=self;
    imagepicker1.tag=101;
    imagepicker1.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagepicker1 animated:YES];
}

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage: (UIImage*)image editingInfo:(NSDictionary *)editingInfo
{
    [picker dismissModalViewControllerAnimated:YES];
    if(picker.tag == 100)
    imgViewForFirstPicker.image=image;
    else
    imgViewForSecondPicker.image=image;
}

try this one hope it will help you

