1

resignFirstResponder当页面滑动时我需要ECSlidingViewController.

如果我使用UIPanGestureRecognizer它。那是覆盖ECSlidingViewController和使用后不能滑动页面。

4

3 回答 3

5

您无需更改现有代码。相反,您应该观察 使用的通知名称之一ECSlidingViewController,例如ECSlidingViewUnderLeftWillAppear。要注册,请在视图控制器的初始化中执行以下操作:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(slidingViewUnderLeftWillAppear:) name:ECSlidingViewUnderLeftWillAppear object:nil];

然后,实现一个像这样的方法:

- (void)slidingViewUnderLeftWillAppear:(NSNotification *)notification {
    [self.view endEditing:YES];
}

希望这可以帮助!

于 2013-06-10T22:32:26.423 回答
1

我自己也找到了办法。可能有人像我一样需要它。

这就是解决方案:

在 ECSlidingViewController.m 文件中找到该行

-(void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)
recognizer

并添加该行

[self.view endEditing:TRUE];
于 2013-04-12T08:05:12.760 回答
0

如果有人使用“SWRevealViewController”,您可以添加

[self.view endEditing:YES];

在下面

  • (void)revealToggleAnimated:(BOOL)动画

它会像一种享受一样工作!

于 2014-03-02T05:25:40.563 回答