views:

47

answers:

1

I have a view with a UITextField which is the first responder. I'm trying to add a semi-transparent view with an activity indicator that would cover everything.

Right now the code looks something like this:

CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[self.window.layer addAnimation:animation forKey:@"fade in spinner"];
[self.window addSubview:spinnerView];

This works great when the view doesn't have an active UITextField, but if it does, the virtual keyboard manages to stay on top of my spinnerView

From what I've read, "modal" subviews (such as UIActionSheet and UIAlertView) use a separate UIWindow to be truly modal, but at the same time Apple recommends not to create more than 1 window in your app.

Any insights would be greatly appreciated

A: 

The problem is that keyboard appears in it's own window, which on the top of your window. So, if you want your view to be always on top you should create it in separate window.

eviltrue
That's what I mentioned in the question, however again, Apple tells us not to create extra windows, so I'm wondering if any other approach is possible. If not, would you be able to provide an example of proper usage of windows? I've tried to find something usable or write my own code, but the window would never appear :(
Nick
If presents of keyboard in background is not critical for you application you could simply hide it before showing that view, and show it again when the view is hidden. Anyway I'll try to solve the problem of showing the window and if it works, I'll let you know =)
eviltrue
Seems impossible to me... gonna mark as resolved since the answer is found
Nick