【发布时间】:2012-07-11 07:06:45
【问题描述】:
touchesBegan: 没有被我的TextSelection 类调用。 TextSelection 是一个 UIView 子类,我将它添加为 ReaderContentPage 的子视图,也是一个 UIView。 ReaderContentPage 是 ReaderContentView 的子视图,一个 UIScrollView。而这个ReaderContentView 在ReaderViewController 内部,一个UIViewController。为了便于理解,这里有一个插图。
现在我的问题是这个。 touchesBegan: 和 touchesMoved: 在 TextSelect 中无法识别。我启用了 userInteraction,使用了 UIPanGestureRecognizer,但这些都不起作用。现在,当我尝试这样做时:[self.ReadContView addSubView:txtSel] 而不是这个[self.ReadContView.ReadContPage addSubView:txtSel],触摸被识别。但是由于某种原因,我必须将它添加到 ReaderContentPage 而不是 ReaderContentView 中。那么,任何人都可以向我解释为什么当我在 ReaderContentPage 中添加 TextSelect 时没有调用 touchesBegan 和 touchesMoved 吗?
【问题讨论】:
-
是否也为 readcontpage 启用了用户交互?
-
嗯,没有任何声明。 userInteraction 是否默认禁用?我会启用它,看看它是否能解决我的问题。
标签: ios cocoa-touch uiview touchesbegan