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()
     }
   }
}
4
  • 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, 2019 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. Oct 21, 2019 at 10:25
  • stackoverflow.com/questions/14740921/… here they mentioned how you can handle touches in multiple windows. might be this one helpful for you, sir. Oct 21, 2019 at 10:33

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.