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;
}

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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...