Closed swoot closed 9 years ago
Note: if I call [self.view endEditing:YES]; before showing the modal view, the bug does not occur.
So might be just me and my faulty coding...
I will check and let you know my feedback on this.
It seems to be an iOS bug. Let me explain.
When we use UIAlertView/UIActionSheet then it present in it’s own UIWindow, so everything works fine as expected due to different UIWindow with proper UIKeyboard hide/show notifications. and it also doesn’t affect anything on our main UIWindow frame.
but when it is presented by UIAlertController then it is presented in our main UIWindow hierarchy. In this case UIKeyboard hide notifications are fired and then UIAlertController is presented. So works fine as expected. But when UIAlertController is dismissed then UIKeyboard show notifications are fired then UIAlertController is dismissed, and IQKeyboardManager find UIAlertController as UIWindow topController and fails to do the calculations.
Expected behaviour:- When UIAlertcontroller is presented then first UIKeyboard hide notifications should fire then UIAlertController should present, and when UIAlertController dismiss then first it should dismiss then UIKeyboard show notifications should fire.
Actual behaviour:- When UIAlertcontroller is presented then first UIKeyboard hide notifications is fired then UIAlertController is presented, but when UIAlertController dismiss then UIKeyboard show notification is fired then UIAlertController is dismissed.
I’ve improved the debugging functionality in current Library. Thanks for your bug report, This issue really need a standard solution.
This is fixed now. You can check the demo project also.
ios 9/10.0.1 still a bug in IQK 4.0.5
@RuslanKim Can you share any demo?
we have no open source yet, but it seems we have a dialog: let alert = UIAlertController( title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) and if we call in editing mode a dialog
If you cannot share a demo then I would suggest you to dismiss keyboard explicitly before presenting UIAlertController.
It seems like it helps, but I hope it would be fixed .)
If you would like it to be fixed then you should share a demo and I can check if issue exist at library side or apple side.
@hackiftekhar We had the same issue and implemented the suggested workaround which fortuantely works. In principle we could also send you a version of the project with the bug, but I guess this is unpaid. I think it is described pretty accurately in the thread how you can replicate the bug, so from my point of view you/Apple could easily replicate the bug with about an hours worth of work. So I prefer that second solution, let me hear your thoughts. Thanks.
It would be better if you could share a demo project @Rotdev
If I'm editing a textField, then press a button that shows a modal view (i.e. UIAlertController) and close that, then as the keyboard shows I press the done button on the keyboard -> whole app goes down instead of just the view.
Steps to reproduce with the IQKeyboardManager example project:
So, am I doing something wrong in general with showing a modal view like that?