UIImage显示两个图像的重复图像

时间:2014-09-24 21:00:43

标签: ios objective-c uiimage

我有一个打开的UImage视图,你可以用它拍照并在uiimageview中查看它。但我添加了另一个图像视图并复制了代码,现在图像显示与第二个相同。我相信它可能与' [UIImagePickerControllerOriginalImage]有关;'

- (void)imagePickerController:(UIImagePickerController *)
picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self dismissViewControllerAnimated:YES completion:nil];

    // Get the image and store it in the image view
    image = info[UIImagePickerControllerOriginalImage];
    self.personimgThumbNail.image = image;

}

- (void)imagePickerControllertwo:(UIImagePickerController *)
picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self dismissViewControllerAnimated:YES completion:nil];

    // Get the image and store it in the image view
    imagetwo = info[UIImagePickerControllerOriginalImage];
    self.personimgThumbNailtwo.image = imagetwo;

}

1 个答案:

答案 0 :(得分:0)

您尝试使用的适当委托方法是imagePickerController:didFinishPickingMediaWithInfo:

您的第二种方法imagePickerControllertwo:didFinishPickingMediaWithInfo:委托方法,不会自动调用。

如果您输入了一些NSLog语句,您可能会发现第一个方法被调用两次(正如预期的那样,因为这是正确的委托方法)。如果你想为每个选择器做不同的事情,请查看picker参数的值;这就是它的用途。