5

我确实有一个具有 UIScrollView 的视图,并且在它上面有一个显示一些文本的视图。当用户在包含文本的视图上滑动时, UIScrollView 不会滚动。如何以将滑动手势中继到 UIScrollView 的方式使此视图透明。

谢谢

4

3 回答 3

2

你可以设置

myTextView.userInteractionEnabled = NO;

或者,如果您使用 Interface Builder 创建视图,那里有一个名为“启用用户交互”的复选框,只需取消选中即可。

于 2010-09-15T19:12:20.357 回答
0

查看UIView hitTest 方法

返回包含指定点的视图层次结构(包括其自身)中接收器的最远后代。

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
于 2012-05-15T12:23:33.867 回答
-1

Inside the -touchesXXXX:withEvent: methods of your custom view, call their super methods to forward touch events.

For example:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  // forward touchesBegan to super class
  [super touchesBegan:touches withEvent:event];

  ... 
  // process touchesBegan for this view
} 

Do the same things for touchesMoved, touchesEnded, and touchesCancelled.

于 2010-09-16T02:01:11.200 回答