2

I have created a second window and add it on top of the default with :

[topWindow makeKeyAndVisible];
topWindow.hidden = NO;

it works but my top window block the access of the application's default window. I want to know if it's possible that if there is no element ( like a button for exemple ) in my top window at a given place of the screen, we can access to the elements of the default window at below.

I hope this is understandable. Sorry for my english. Thanks by advance for your help.

6
  • Why are you using two windows? iOS apps are expected to have only one window per screen. Can you use a view in place of the top window?
    – Caleb
    Jul 11, 2013 at 7:26
  • It's to have a layer at the top of my app which don't interfere with the main Window of my app
    – Jonathan
    Jul 11, 2013 at 13:26
  • Strangely, your comment appears in French in my in box. Did you write it in French first and then edit it? Just wondering.
    – Caleb
    Jul 11, 2013 at 14:46
  • Yes I made a mistake with a copy and paste in google translation to check my English. But normally I have already correct my mistake. Sorry !
    – Jonathan
    Jul 11, 2013 at 14:56
  • I write this : "It's to have a layer at the top of my app which don't interfere with the main Window of my app"
    – Jonathan
    Jul 11, 2013 at 14:59

1 Answer 1

1

I have created a second window and add it on top

So, I think the usual expectation is that there's just one window per screen in an iOS app. The docs seem to imply this:

Every app has one window that displays the app’s user interface on an iOS-based device display. If an external display is connected to the device, an app can create a second window to present content on that display as well.

It's possible that iOS simply assumes that there's only one window per screen, and so the hit-testing process only considers one window, probably the key window. Since you're making your second window the key window, I'd suggest making the first window key after you create the second window and see if that changes things. It wouldn't be surprising if the first window then receives touches and the second doesn't. If you find that's the case, you might Subclass UIWindow, override -hitTest:withEvent: to pass the event to other windows if no hit view is found, and then use that subclass for both your windows.

Otherwise, if you can't get that to work, consider going back to a single window and using different views instead. Your question is somewhat similar to Make this view appear in every view, inside the app, and my suggestion there to create your own container view controller might help you.

Your Answer

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.