Display To Images
using two UIImageview And two button when tap a first button image picker
let you chose image
from photo library and same to the second button. this is what i did
using two UIImageview And two button when tap a first button image picker
let you chose image
from photo library and same to the second button. this is what i did
viewcontroler.h
UIImagePickerController *pic1;
UIImagePickerController *pic2;
UIImage *image1;
UIImage *image2;
IBOutlet UIImageView *imageview1;
IBOutlet UIImageView *imageview2;
- (IBAction)Load1:(id)sender;
- (IBAction)Load2:(id)sender;
vewcontroller.m
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
image1 = [info objectForKey:UIImagePickerControllerOriginalImage];
image2 = [info objectForKey:UIImagePickerControllerOriginalImage];
[imageview1 setImage:image1];
[imageview2 setImage:image2];
[self dismissViewControllerAnimated:YES completion:NULL];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (IBAction)Load1:(id)sender
{
pic1 = [[UIImagePickerController alloc]init];
pic1.delegate = self;
[pic1 setSourceType:UIImagePickerControllerSource`TypePhotoLibrary];
[self presentViewController:pic1 animated:YES completion:NULL];
}
- (IBAction)Load2:(id)sender
{
pic2 = [[UIImagePickerController alloc]init];
pic2.delegate = self;
[pic2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:pic2 animated:YES completion:NULL];
}
when i run. the first button work. let you chose the image from photo
library and display it, the second button work as will but the image you
chose display in both UIImageview
what i did wrong here, thanks
No comments:
Post a Comment