Touchesbegan not detecting what is being touched

前端 未结 2 1987
情歌与酒
情歌与酒 2021-01-14 22:09

I\'m building a rotating banner using a NSTimer to keep track of the current image with the image being animated from 5 different images. I have a touchesBegan set up to kee

2条回答
  •  再見小時候
    2021-01-14 22:42

    Not sure what would cause that but have you tried using a UIGestureRecognizer? Try something like the code below and see if the method gets called.

      //Add Gesture Recognizer
      UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self    action:@selector(imageSelected)];
      tapped.numberOfTapsRequired = 1;
      [theImageView addGestureRecognizer:tapped];
    
      //Memory Cleanup
      [tapped release];
    
     -(void)imageSelected
      {
        NSLog(@"Selected an Image");
      }
    

提交回复
热议问题