hitTest中的返回窗口不起作用

时间:2016-05-31 14:14:02

标签: ios uiwindow

我正在尝试添加自定义UIWindow并将事件转发到mainWindow

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

在mainWindow.rootViewController.view中传递View时有效 但我想将它传递给mainWindow

1 个答案:

答案 0 :(得分:0)

我的问题的解决方案是返回零 它会将它传递给下一个托管窗口

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