I'm having troubles entering text into an UITextField under a SVProgressHUD (Basically an UIView with a full-screen transparent UIWindow and some UIView subviews showing text and a custom-drawn progress bar).
My problem is that the UITextField displays the blinking cursor and the keyboard shows, but when I tap a key, nothing is entered into the text field. I only see that the cursor's blinking interrupts just like normal. Interestingly enough, the back (delete) key works (it really deletes the last letter in the UITextView), but not any other key.
I'm using iOS 6.
Any help would be highly appreciated.
EDIT:
The same UITextField works fine when there's no SVProgressHUD displayed. This makes me think it has something to do with the first responder, but I have already tried calling resignFirstResponder
on every window and subview of the SVProgressHUD and it still does not work.
I finally found the problem:
SVProgressHUD calls makeKeyAndVisible
when it's initialized, because it wants to receive keyboard notifications for repositioning. I looked up what the "Key Window" actually is and found out:
...The key window responds to user input...
Now, as the UIWindow of the SVProgressHUD was the keyWindow, my other window, which contained the UITextField did not get the user input.
I finally call makeKeyWindow
on the AppDelegate's window and everything is working fine.
I hope this helps anyone with similar problems.
Call resignFirstResponder()
to dismiss the keyboard before showing SVProgressHUD
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With