Question

I have an overlay view (covering the entire screen), I can receive touches but it isn't passing them down the responder chain.

I add the subview like this:

UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
[mainWindow insertSubview:self.view aboveSubview:mainWindow];

It doesn't seem to matter if I use addSubview or insertSubview.

My touchesBegan looks like:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{        
    //do some stuff here..
    [super touchesBegan:touches withEvent:event];
}

It doesn't seem to matter if I am using SUPER or various other combinations of self.nextResponder, etc..

In the end, I need to have an overlay view that covers the entire screen, I need to detect touches then pass them to the views/viewControllers below them.

Thanks!

Was it helpful?

Solution

You are addView to the mainWindow, your super view is the mainWindow, not the viewBlow it.

You need to add the view to VC's view, and if you want the full screen. set the status bar to hidden (or transparent. not tried) and then set the view's frame to (0, -20, weight, height+20).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top