1

I have two windows. One is completely in background and another one is in foreground. How to disable interactions for only background view and not for the foreground view using swift?

Ideally I'm calling the method beginIgnoringInteractions() from background window.

I tried override the UIApplication like below:

extension UIApplication {
   override func beginIgnoringEvents() {
     if forgroundWindowIsPresent {
     } else {
        super.beginIgnoringEvents()
     }
   }
}
Saranjith
  • 11,242
  • 5
  • 69
  • 122
  • https://stackoverflow.com/questions/1101965/how-can-i-disable-the-touch-detection – Muhammad Shauket Oct 21 '19 at 10:11
  • this link says the way to disable only for a view with userInteractionEnabled or for entire app using beginIgnoringInteractionEvents(). I want to disable for a background window (UIWindow) – Saranjith Oct 21 '19 at 10:13
  • UIWindow inherited from UIView so it must work in case of the window as well. if you stop touches for window then whole window will be non-responder. – Muhammad Shauket Oct 21 '19 at 10:25
  • https://stackoverflow.com/questions/14740921/passing-touches-between-stacked-uiwindows here they mentioned how you can handle touches in multiple windows. might be this one helpful for you, sir. – Muhammad Shauket Oct 21 '19 at 10:33

0 Answers0