在我的测试应用程序中,我有两个按钮(takePhoto1和takePhoto2)和两个UIImageView(photo1View和photo2View)。第一个按钮拍摄一张照片并将其显示在第一张图像视图中。第二个按钮拍摄另一张照片,应该显示在第二个图像视图中。但是,由于某种原因,第二张照片将显示在photoView1而不是photoView2中。在不同的UIImageView中显示照片
我还没有实现任何代码来保存照片,所以我并不担心图片视图中持续存在的照片。
我需要弄清楚的是如何确定何时拍摄第二张照片,它会显示在相应的视图中。这是我到目前为止:
//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;
}
任何人都知道如何解决这个问题?
谢谢,完美的工作!该示例项目非常有用。干杯! – narner 2014-09-06 23:18:39