推送新视图时缺少触摸事件

发布于 2024-08-27 18:02:40 字数 263 浏览 5 评论 0原文

我是 iPhone 编程新手。目前我正在尝试识别持续的触摸。例如,我希望用户在整个应用程序中将手指放在屏幕上。

我使用一个包含不同视图的导航控制器。如果用户现在触摸 view1 中的屏幕,然后通过将其推入堆栈(使用 pushviewcontroller)将视图更改为 view2,同时仍然触摸屏幕,则 view2 不会识别任何触摸事件。如果用户随后松开手指(无触摸事件)并再次触摸屏幕,则所有事件都会被识别。这是一个错误还是我做错了什么?

我还没有找到任何答案。有人可以帮助我吗?

I am new in iPhone programming. At the moment I am trying to recognize a constant touch. For example I want the user to leave his finger on the screen for the whole application.

I use a navigationcontroller which holds the different views. If the user now touches the screen in view1 and then the view is changed to view2 by pushing it on the stack (with pushviewcontroller) with still touching the screen then there are no touch events recognized by view2. If the user then releases his finger (no touch event) and touches the screen again then all events are recognized. Is this a bug or am I doing something totally wrong?

I haven't found any answer on this. Could someone help me?

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

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

发布评论

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

评论(1

我只土不豪 2024-09-03 18:02:40

这是预期的行为。触摸是按视图处理的。

如果不覆盖透明视图来处理触摸,则无法使用导航控制器更改视图。

如果您确实覆盖了一个透明视图来处理触摸,那么下面的其他视图将不会接收触摸事件,除非您通过使用一些复杂的过程来传播它们。

This is expected behaviour. Touches are handled on a per-view basis.

Without overlaying a transparent view to handle touches, you can't change views using a navigation controller.

If you do overlay a transparent view to handle touches then no other views below that will receive touch events unless you propagate them through using some convoluted process.

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