0

我开发的应用程序有很多视图,但是当我想使用平移手势移动某个视图(backgndView)时,另一个视图被移动了。似乎我想要的视图不活跃。这里是代码。

//---pan gesture---
UIPanGestureRecognizer *panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];

[backgndView addGestureRecognizer:panGesture];
[frameView addGestureRecognizer:panGesture];
[effectView addGestureRecognizer:panGesture];
[itemView addGestureRecognizer:panGesture];
[extraView addGestureRecognizer:panGesture];
[panGesture release]; 

我认为 extraView 对手势有效,但对其他视图无效。还有其他方法可以使选定的视图处于活动状态吗?

谢谢。

4

1 回答 1

0

Didnt understand problem well but something like blow makes all views active for pan gesture.

//---pan gesture---

UIPanGestureRecognizer *panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];

[backgndView addGestureRecognizer:panGesture];
[panGesture release]; 

panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];
[frameView addGestureRecognizer:panGesture];
[panGesture release]; 

panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];
[effectView addGestureRecognizer:panGesture];
[panGesture release]; 

panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];
[itemView addGestureRecognizer:panGesture];
[panGesture release]; 

panGesture =
[[UIPanGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(handlePanGesture:)];
[extraView addGestureRecognizer:panGesture];

[panGesture release]; 
于 2011-09-16T10:35:15.840 回答