举例讲解iOS应用开发中hitTest触摸事件的编写方法

2020-01-15 14:22:45王旭

{
    NSLog(@"A - touchesMoved..");
     
}
这样就实现了向父View透传消息。

 

不让ViewB收到消息,可以设置ViewB.UserInteractionEnable=NO;除了这样还可以override掉ViewB的ponitInside,原理参考上面。

在ViewB上写:

复制代码
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    // 本View不响应用户事件
    return NO;
  
}

注:相关教程知识阅读请移步到IOS开发频道。