【发布时间】:2014-05-25 13:44:40
【问题描述】:
我在我的应用程序中使用SWRevealViewController,但我遇到了问题。我在场景中有一个文本字段,如果我在键盘打开时向左滑动,菜单会出现但不会关闭键盘。如何在左滑时关闭键盘?
我试过了
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
swipe.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeRecognizer];
-(void)dismissKeyboard
{
[self.textField resignFirstResponder];
}
但它不起作用,我想是因为我已经在使用 panGestureRecognizer 来显示视图控制器,即[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
我也在使用UITapGestureRecognizer,但它只适用于点击而不是滑动。
【问题讨论】:
-
看我的回答希望对你有帮助..
-
看我更新了我的答案检查它
标签: ios swrevealviewcontroller