我有一个UIView并且我在视图上添加了UILongGestureRecognizer和UIPanGestureRecognizer。当我点击并按住它几秒钟时,我得到了 LongPress 识别的回调。
代码如下图
- (void)addPanGsetureForView:(UIView *)object
{
UIPanGestureRecognizer * panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognised:)];
[object addGestureRecognizer:panGesture];
[panGesture release];
}
- (void)addLongPressGsetureForView:(UIView *)object
{
UILongPressGestureRecognizer * longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(imageLongPressed:)];
[longPress setMinimumPressDuration:1.0];
[object addGestureRecognizer:longPress];
[longPress release];
}
所以我想使用平移手势移动视图。因此,当在视图上没有移开手指的情况下识别出长按时,我希望平移手势得到识别。如果我移开手指并再次点击并平移它,它就会被识别。
所以请帮我解决这个问题。
提前致谢