ios - touchesEnd 未被调用位 touchesBegin 和 touchesMoved 确实被调用

标签 ios

我正在尝试在 ios 中进行拖动。如果拖动移动的距离很短,我将通过比较起始 x、y(从 touchesBegan 开始)与 touchesEnd 中的 x、y 来将拖动计为单击事件。 似乎 touchesEnd 永远不会被调用。我设置了一个断点来验证它,断点从未消失。

code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    NSUInteger touchCount = [touches count];
    NSUInteger tapCount = [[touches anyObject] tapCount];

    [ self UpdateDrag];

   }

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    NSUInteger touchCount = [touches count];
    NSUInteger tapCount = [[touches anyObject] tapCount];

    }


- (void) touchesEnd:(NSSet *)touches withEvent:(UIEvent *)event {
   // this methes never gets called 
    NSUInteger touchCount = [touches count];
    NSUInteger tapCount = [[touches anyObject] tapCount];


    if (mDisplay==nil)
    {
        mDisplay = [[cDisplayYesOrNo_iPhone alloc]
                    initWithNibName:@"cDisplayYesOrNo_iPhone"
                    bundle:[NSBundle mainBundle]];
    }
    [ mDisplay SetUp];
    [self presentModalViewController: mDisplay animated:NO];


}

最佳答案

关于ios - touchesEnd 未被调用位 touchesBegin 和 touchesMoved 确实被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18857736/

相关文章:

ios - Collection View - 从不同文件夹接收图像 - 如何?

ios - 在 Collection View 单元格中播放视频,就像在 Facebook 应用程序时间轴中播放的视频一样

iphone - 就iPhone应用程序而言,当后台应用程序恢复事件时自动重新加载显示页面的方式

android - 无法制作圆形头像

ios - 突出显示或下划线字符串中的特定单词

iphone - 核心运动陀螺仪360度值

ios - Firestore .orderBy 服务器时间戳不起作用 SWIFT

ios - ARKit 2 卡住 : a bug or my misfortune?

ios - 如何在 iOS 12 中以编程方式终止应用程序

ios - UIView transitionFromView :toView: and layout constraints