Add multiple pictures to UIViewcontroller
I Want to add four different pictures to a ViewController. I am able to add one picture. And when i try to add another picture in a different Imageview, the same pictures appears on both the imageviews. Could anyone please give an idea of how to add unique pictures.
- (void)imagePickerControllerUIImagePickerController *)picker didFinishPickingMediaWithInfoNSDictionary *)info {
if(choosePhoto1){
NSLog(@"buttonclicked:button1");
theimageView1.image = [开发者_开发问答info objectForKey:@"UIImagePickerControllerOriginalImage"];
[picker dismissModalViewControllerAnimated:YES];
}
else if(choosePhoto2) {
NSLog(@"buttonclicked:button2");
theimageView2.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[picker dismissModalViewControllerAnimated:YES];
}
}
Thanks.
If you created the .xib in interface builder, be sure to go into it and ensure that you've wired up each imageview to the IBOutlets for their views and not the same one for all.
Add some code ... simply from your description nobody can help you. The educated guess is that your not creating a new object each time you add or your passing the same reference several times
Form your code I would say your setting twice the same image:
in both cases you use @"UIImagePickerControllerOriginalImage"
so if info is the same object both times its normal your getting the same image
精彩评论