在我的测试应用程序中,我有两个按钮(takePhoto1 和 takePhoto2)和两个 UIImageView(photo1View 和 photo2View)。第一个按钮拍摄照片并将其显示在第一个图像视图中。第二个按钮拍摄另一张照片,并且应该在第二个图像视图中显示它。但是,由于某种原因,第二张照片显示在 photoView1 而不是 photoView2 中。
我还没有实现任何代码来保存照片,所以我不担心照片会保留在图像视图中。
我需要弄清楚的是如何确保拍摄第二张照片时,它会显示在适当的视图中。这是我到目前为止所拥有的:
//Take photo1 and display in top image view
- (void)takePhoto1;
{
[self dismissViewControllerAnimated:YES completion:NULL];
if ([self.capturedImages count] > 0)
{
if ([self.capturedImages count] == 1)
{
// Camera took a single picture.
[self.photo1View setImage:[self.capturedImages objectAtIndex:0]];
}
// To be ready to start again, clear the captured images array.
[self.capturedImages removeAllObjects];
}
self.imagePickerController = nil;
}
//Take photo2 and display in bottom image view
- (void)takePhoto2;
{
[self dismissViewControllerAnimated:YES completion:NULL];
if ([self.capturedImages count] > 0)
{
if ([self.capturedImages count] == 1)
{
// Camera took a single picture.
[self.photo2View setImage:[self.capturedImages objectAtIndex:1]];
}
// To be ready to start again, clear the captured images array.
[self.capturedImages removeAllObjects];
}
self.imagePickerController = nil;
}
有人知道怎么修这个东西吗?