我有一个带有一个的subview
,主视图有一个。我已经将唯一添加到这样的视图中:imageview
PanGestureRecognizer
LongPressGestureRecognizer
longpress
screenRecognize = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(screenTaped:)];
screenRecognize.minimumPressDuration = 0.0;
self.userInteractionEnabled = YES;
[self addGestureRecognizer:screenRecognize];
这是图像视图:
imageViewPanRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewPulled:)];
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(310, 50, 10, 40)];
imageView.image = [UIImage imageNamed:@"image.png"];
imageView.userInteractionEnabled = YES;
[imageView addGestureRecognizer:imageViewPanRecognizer];
[self addSubview:imageView];
当我触摸 时imageView
,UILongPressRecognizer
被触发。为什么是这样?