为什么当触摸次数发生变化时,touchesBegan 不会触发?

发布于 2024-10-08 00:53:29 字数 325 浏览 0 评论 0原文

由于某种原因,我的 TouchBegan 方法似乎没有正确响应。如果我用两根手指触摸屏幕,然后抬起一根手指并再次放下,touchesBegan 就会被正确调用。如果我用一根手指触摸屏幕,然后添加第二根手指,触摸开始不会像它应该的那样被调用。我需要检查一些标志吗?下面是一个说明我的问题的示例:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     NSLog(@"touch");
}

有什么想法发生了什么吗?如果重要的话,我正在运行 iOS 4.2 的 iPad 上进行测试。

For some reason my touchesBegan method doesn't seem to be responding correctly. If I touch the screen with two fingers, then lift one up and put it down again, touchesBegan gets called correctly. If I touch the screen with one finger, then add a second finger, touchesBegan does not get called like it should. Is there some flag that I need to check? Below is a sample that illustrates my problem:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     NSLog(@"touch");
}

Any ideas what's going on? I'm testing on an iPad with iOS 4.2 if it matters.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-10-15 00:53:29

是的,您需要设置 multipleTouchEnabled 视图上的属性。

当设置为NO时,接收器接收
仅一个中的第一个触摸事件
多点触摸序列。默认
该属性的值是 NO。

Yes, you need to set the multipleTouchEnabled property on your view.

When set to NO, the receiver receives
only the first touch event in a
multi-touch sequence. The default
value of this property is NO.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文