Open Piyush-Sharma-Pandit opened 5 years ago
Did you find any solution. I am facing same issue and did not find any solution.
@jonkykong is there any solution for this behaviour??
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
textField.endEditing(true)
}
override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) textField.endEditing(true) }
It was the very first thing i tried
@rehmanateeq No i have tried many things but cant find any way of doing this. So i have disabled the pan gesture and currently having sidemenu only from tapping the side menu button. Note:- There are some delegate method of the sidemenu
So logically calling end editing in them should work fine but it is not working. if someone has the solution of this problem please let me know.
Anyone find an update for this? I am experiencing the same thing :(
I was facing the same issue.
For me issue occurred when: I clicked textField and then opened new ViewController by selecting another SideMenu option. Then there was black view at bottom.
Below solution worked for me.
self.dismiss(animated: true) { () -> Void in self.customNavigationController.pushViewController(viewController, animated: true) }
I found this on one of Issue: "The problem is the presenting controller of Menu still live although SidMenu go away , so you should make it nil , to do that call self.dismiss(animated: false, completion: nil) method when you want go away from SideMenu."
I was not dismissing my SideMenu while pushing another ViewController. So when I did dismiss SideMenu and on its completion then I pushed my ViewController. It resolved the issue for me.
P.S.: I am using customNavigationController so that it will not push ViewController on SideMenuNavigationController.
I was facing the same issue.
For me issue occurred when: I clicked textField and then opened new ViewController by selecting another SideMenu option. Then there was black view at bottom.
Below solution worked for me.
self.dismiss(animated: true) { () -> Void in self.customNavigationController.pushViewController(viewController, animated: true) }
I found this on one of Issue: "The problem is the presenting controller of Menu still live although SidMenu go away , so you should make it nil , to do that call self.dismiss(animated: false, completion: nil) method when you want go away from SideMenu."
I was not dismissing my SideMenu while pushing another ViewController. So when I did dismiss SideMenu and on its completion then I pushed my ViewController. It resolved the issue for me.
P.S.: I am using customNavigationController so that it will not push ViewController on SideMenuNavigationController.
This Fixed my issue. Thanks
Anyone find an update for this? I am experiencing the same thing :(
Just dismiss Side Menu before pushing/showing another controller
@aherpooja can you please provide a proper example with original code .
@Piyush-Sharma-Pandit When you select any menu option from Side menu before pushing/presenting another view controller first dismiss Side menu.
self.dismiss(animated: true) { () -> Void in self.customNavigationController.pushViewController(viewController, animated: true) }
@aherpooja How did you create the sample customNavigationController? Can you share please?
I also ran into this problem. It appears that UIKit tries to remember if the keyboard is visible when a view controller is shown over another view controller and then closes the keyboard. When the front view controller goes away it restores the keyboard if it was showing. To avoid this problem you have to close the keyboard before showing the side menu. Once the side menu starts to become visible it's too late to prevent UIKit from this process of saving and restoring the keyboard state. I worked around this by closing the keyboard from a custom back button before showing the side menu. This code uses some other methods of mine but you get the idea.
private func setupNavigationItem() {
navigationItem.leftBarButtonItem = UIBarButtonItem.buttonWithBurgerMenu(action: #selector(self.openSideMenuSpecial), target: self)
}
@objc func openSideMenuSpecial() {
// resignFirstResponder before opening the sideMenu
// Otherwise there are crazy animations with the keyboard
resignFirstResponderTextFields()
openSideMenu()
}
There is some code in SideMenuNavigationController
that attempts to avoid this problem but in my case that code was too late. Any of the viewWillAppear
, viewDidAppear
or SideMenu
delegate callbacks were also too late and resulted in the keyboard going away but it still came back with some crazy animations.
@phoney feel free to propose a more robust solution directly to the source code that alleviates this issue.
Any update
Any update
@objc func openMenu() { self.view.endEditing(true) let leftRootVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: "LeftMenuViewController") let leftMenuNavigationController = SideMenuNavigationController(rootViewController: leftRootVC) leftMenuNavigationController.leftSide = true self.present(leftMenuNavigationController, animated: true, completion: nil) }
I have read the guidelines for contributing and I understand
Describe the bug The bug is Keyboard Hides when sidemenu appears but after closing side menu keyboard appears again. normally this thing does not cause any problem at all. but the only big problem occurs while going to other view from side menu. more explaination in "To Reproduce".
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Note:= if i do all this without opening keyboard in starting than it works fine.
Additional context Add any other context about the problem here.