Search code examples
iosuiwindow

Return window in hitTest does not work


I am trying to add custom UIWindow and forward the event to the mainWindow

-(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *hitView = [super hitTest:point withEvent:event];
if (hitView == self.myView) {
    return hitView;
}else{
    return mainWindow;
}}

It works when passing the View inside mainWindow.rootViewController.view but I want to pass it to the mainWindow


Solution

  • The solution for my question is returning nil it will pass it to next hosted window

    -(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event{
      UIView *hitView = [super hitTest:point withEvent:event];
        if (hitView == self.myView) {
            return hitView;
           }else{
             return nil;
          }}