我有 6 个带有标签的图像视图。在图像视图上单击一下,我调用 UIActionSheet 以显示按钮“拍照”和“选择图片”。这一切都很好。在我最终设置所选图像的 imagePickerController 中,我如何知道要更新图片的 Imageview。请让我知道如何传递我的标签值来更新正确的点击图像。
这是我的代码。
viewDidLoad
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(tappedImage:)];
tapGestureRecognizer.numberOfTapsRequired = 1;
[self.photo1 addGestureRecognizer:tapGestureRecognizer];
[self.photo2 addGestureRecognizer:tapGestureRecognizer];
[self.photo3 addGestureRecognizer:tapGestureRecognizer];
[tapGestureRecognizer setDelegate:self];
轻拍图像
- (void)tappedImage:(UIGestureRecognizer *)sender {
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Add a Picture"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take Picture",@"Select Picture", nil];
[actionSheet showInView:self.view];
}
}
图像选择器控制器
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
[picker dismissModalViewControllerAnimated:YES];
[photo1 setImage:image];
}
目前所有图像都设置为 Photo1 Imageview。
任何帮助将不胜感激。