ios – 堆叠的UIWindows之间的传递?

我有两个窗户 – 前面一个,后面一个.前面的一个用于覆盖一些东西在背面的顶部.我想要能够捕获前窗的某些部分的触摸,而不是其他部分;我希望前面的窗口在某些地方接受触摸,但将其传递到其他人的后窗.

关于我该怎么做的任何想法?

解决方法

好的,这是我做了什么:我在前台创建了两个视图.第一个观点涵盖了我想要触及的地方;第二,我想要触动的地方.我分类UIWindow并覆盖hitTest:withEvent方法如下:
- (UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event {

  // See if the hit is anywhere in our view hierarchy
  UIView *hitTestResult = [super hitTest:point withEvent:event];

  // ABKSlideupHostOverlay view covers the pass-through touch area.  It's recognized
  // by class,here,because the window doesn't have a pointer to the actual view object.
  if ([hitTestResult isKindOfClass:[ABKSlideupHostOverlayView class]]) {

    // Returning nil means this window's hierachy doesn't handle this event. Consequently,// the event will be passed to the host window.
    return nil;
  }

  return hitTestResult;
}

在创建前窗的课程中,我使用手势识别器捕获第一个视图的触摸.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...