如何解雇SearchDisplayController键盘?

时间:2013-05-16 02:32:04

标签: ios uisearchdisplaycontroller

我正在尝试创建iPad应用程序,它有两个UIView s(如UISplitView)。 “主”方面有UISearchDisplayController

我需要通过点击外部(“主”或“细节”侧)来解除键盘。现在我只能通过点击其中的关闭按钮或点击UISearchDisplayController来解除键盘。

rmaddy 的帮助下

已解决

@interface MyViewController : UIViewController <UIGestureRecognizerDelegate>
...
...
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard:)];
tapGesture.delegate = self;
[self.view addGestureRecognizer:tapGesture];
...
...
- (void)dismissKeyboard:(UITapGestureRecognizer *)sender
{
    if (sender.state == UIGestureRecognizerStateEnded) {
        self.searchDisplayController.active = NO;
    }
}

0 个答案:

没有答案