触摸UIScrollView中不适用于UIViews的事件 [英] Touch events not working on UIViews inside UIScrollView

查看:119
本文介绍了触摸UIScrollView中不适用于UIViews的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UIScrollView中有一系列UIViews,这些视图的UIViewControllers没有接收到触摸事件。如果我从滚动视图中取出视图,那么它可以正常工作。

I have a series of UIViews inside a UIScrollView, and the UIViewControllers for those views are not receiving the touch events. If I take the views out of the scroll view then it works.

我已经在视图上启用了userInteraction,但它仍然无效!

I have enabled userInteraction on the views but it's still not working!

这一定是可能的,如果有人能指出我正确的方向,我真的很感激!

This must be possible and I'd be really grateful if someone could point me in the right direction!

谢谢,

Mike

推荐答案

我通过覆盖视图控制器的loadView方法克服了这个问题,并将视图的实例变量设置为一个传递触摸的简单UIView子类。

I have overcome this issue by overriding the loadView method of the view controller, and setting the view's instance variable to a simple UIView subclass which passes on the touches.

这篇关于触摸UIScrollView中不适用于UIViews的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆