推送新视图时缺少触摸事件
我是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是预期的行为。触摸是按视图处理的。
如果不覆盖透明视图来处理触摸,则无法使用导航控制器更改视图。
如果您确实覆盖了一个透明视图来处理触摸,那么下面的其他视图将不会接收触摸事件,除非您通过使用一些复杂的过程来传播它们。
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.