ECSlidingViewController,无法关闭菜单

时间:2013-06-20 18:24:50

标签: ios6 ecslidingviewcontroller

我正在使用ECSlidingViewController作为我的菜单,我有一个初始控制器,菜单和主页以及登录页面。 在初始视图控制器中,如果用户通过身份验证,则会看到主页,否则我会显示登录对话框。 (使用自我topViewController)

一切似乎都运转正常,我遇到的问题是当我在家庭视图控制器中时

如果我点击菜单图标(我以编程方式添加),菜单会显示,但如果我再次点击关闭它,则没有任何反应,菜单仍然可见。

我添加了一个NSLog,我能够看到我正在调用正确的方法

- (IBAction)revealSidebar
{
 NSLog(@"reveal ");
    [self.slidingViewController anchorTopViewTo:ECRight];

}

然而,菜单并没有隐藏自己。

附上一些截图以获得想法。

NSLog(@“here”);

2 个答案:

答案 0 :(得分:1)

ECSlidingViewController发布以下通知(其中包括):

/** Notification that gets posted when the underLeft view will appear */
extern NSString *const ECSlidingViewUnderLeftWillAppear;

/** Notification that gets posted when the underLeft view will disappear */
extern NSString *const ECSlidingViewUnderLeftWillDisappear;

您可以注册接收这些通知,然后实现这样的处理程序方法:

- (void)handleMenuDidShowNotification:(NSNotification *)notification
{
    [self.menuItem setAction:@selector(closeMenu:)];
}

- (void)handleMenuDidHideNotification:(NSNotification *)notification
{
    [self.menuItem setAction:@selector(openMenu:)];
}

- (void)closeMenu:(id)sender
{
    [self.slidingViewController anchorTopViewTo:ECRight];
}
- (void)openMenu:(id)sender
{
    [self.slidingViewController resetTopView];
}

答案 1 :(得分:0)

尝试升级到ECSlidingViewController的适当版本。在提出此问题时使用的版本存在设置手势太晚的问题。此问题已在1.0.1版中修复。