开发者

Keyboard appears on top of view where no user interaction should be allowed

开发者 https://www.devze.com 2023-03-06 19:17 出处:网络
I have a window-based project with two UITextFields to take input from the user. Both are in my view controller.

I have a window-based project with two UITextFields to take input from the user. Both are in my view controller.

I have to parse stuff in the background, so I need something that blocks user interaction in the meanwhile. I came across this Cocoa With Love tutorial to create a loading view on top of everything. It actually works pretty well, for the most part; it works when ever t开发者_运维问答he text field resigns first responder.

There is one circumstance where it doesnt work, though. When I type something in the first text field and then select the second one, the loading screen will appear, but the keyboard is on top of it, so the user could type something. I want the loading screen to be on top of the keyboard.

In the tutorial, it says to call the keyboard's superview. What is the keyboard's superview? I tried the following different snippets in my view controller, but nothing works.

loadingView = [LoadingView loadingViewInView:[self.view.window.subviews     objectAtIndex:0]];

loadingView = [LoadingView loadingViewInView:self.view];

loadingView = [LoadingView loadingViewInView:self.view.superview];

How can I make the loading screen appear on top of everything ?


The simple solution is to dismiss the keyboard when you show the loading view. I don't think you're allowed to put anything on top of the keyboard.

That said, you could try using the root window as the view to see if that has any effect.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号