Question

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

Was it helpful?

Solution

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.

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