0

SWRevealViewController dismiss keyboard on swipe

Problem is the same but this answers does not help me.

There are some solutions in the given link.For example I don't have any #if macros to delete and I get an error when I write revealController.delegate = self; in AppDelegate.m

And the delegate method below never get called.

- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position
{
//Never get called
}

I searched the Internet and did everything mentioned in the given link.

I am using SWRevealViewController V 1.1.3 https://github.com/John-Lluch/SWRevealViewController/releases

The problem is: I have a UITextField inside a ViewController which behaves as a Front View.When I click on UITextField, keyboard shows up, then I swipe to see my ViewController which behaves as Rear View but keyboard is still there and I can't hide it.

How can I make it possible?

Community
  • 1
  • 1
Okhan Okbay
  • 1,374
  • 12
  • 26
  • Solved: I added `self.revealController.delegate = self;` to my View Controller which I used as Front View.And delegate method get called.I used `- (void)revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position{}` delegate method and I wrote `[textField endEditing:YES];` in this delegate method. – Okhan Okbay Oct 22 '14 at 08:02
  • Also added `` – Okhan Okbay Oct 22 '14 at 08:07

1 Answers1

0

I tried using willMove to position.........However it displays the keyboard when the Rear View controller pops up soon after the keyboard gets hidden..........

For me this worked perfectly....

func revealControllerPanGestureShouldBegin(revealController: SWRevealViewController!) -> Bool {
    self.view.endEditing(true)
    return true
}
Cloy
  • 2,141
  • 23
  • 32