私のアプリケーションでは、ランダムに移動する3つのuiimageviewがあります。imageviewをシングルタップすると非表示になります。しかし、私のタペスチャは機能していません。シングルタップでは非表示になりません。
- (void)showAlert1:(UITapGestureRecognizer *)sender
{
if (image1.tag == 1)
{
image1.hidden = TRUE;
}
else
{
image1.hidden = FALSE;
}
}
- (void)showAlert2:(UITapGestureRecognizer *)sender
{
if (image1.hidden == TRUE && image3.hidden == FALSE)
{
image2.hidden = TRUE;
}
else
{
image2.hidden = FALSE;
}
}
- (void)showAlert3:(UITapGestureRecognizer *)sender
{
if (image1.hidden == TRUE && image2.hidden == TRUE)
{
image3.hidden = TRUE;
}
else
{
image3.hidden = FALSE;
}
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (image1.tag == 1)
{
image1.userInteractionEnabled = YES;
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTargetelf actionselector(imageAlerts];
tap.numberOfTapsRequired = 1;
[image1 addGestureRecognizer:tap];
}
if (image2.tag == 2)
{
image2.userInteractionEnabled = YES;
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTargetelf actionselector(showAlert2];
tap.numberOfTapsRequired = 1;
[image2 addGestureRecognizer:tap];
}
if (image3.tag == 3)
{
image3.userInteractionEnabled = YES;
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTargetelf actionselector(showAlert3];
tap.numberOfTapsRequired = 1;
[image3 addGestureRecognizer:tap];
}
}
誰か助けてもらえますか?
前もって感謝します