0

当您使用按钮打开和关闭菜单时,它会突然关闭,但是,当您单击带有菜单的项目时,它会弹回另一侧然后再返回。

虽然这是一个很好的效果,但它不起作用所以我现在正在做的事情,可以禁用它吗?我只是希望它在用户单击菜单项时快速关闭。

编辑

didSelectecItemAtIndex 中的代码是

UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
[self.slidingViewController anchorTopViewOffScreenTo:ECLeft animations:nil onComplete:^{
        CGRect frame = self.slidingViewController.topViewController.view.frame;
        self.slidingViewController.topViewController = newTopViewController;
        self.slidingViewController.topViewController.view.frame = frame;
        [self.slidingViewController resetTopView];
    }];
4

2 回答 2

2

我有同样的问题,但我找到了解决方案。这是我的代码:

[self.slidingViewController anchorTopViewOffScreenTo:ECANCELED animations:nil onComplete:^{
            ObjHomeView.navigationItem.title=[[dataList objectAtIndex:indexPath.row] objectForKey:@"Menu_Name"];
            CGRect frame = self.slidingViewController.topViewController.view.frame;
            self.slidingViewController.topViewController = ObjHomeView;
            self.slidingViewController.topViewController.view.frame = frame;
            [self.slidingViewController resetTopView];
        }];

这里

[self.slidingViewController anchorTopViewoffScreenTo:ECANCELED animations:nil onComplete:^{
 You can put your code

}];

只是把论据ECCANCELED。我希望你的问题能得到解决。

于 2013-11-01T11:01:50.040 回答
1

anchorTopViewOffScreenTo:animations:onComplete:并且resetTopView是导致顶视图移动的方法。

听起来你只想设置一个新的topViewControllerresetTopView就像这样:

UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
CGRect frame = self.slidingViewController.topViewController.view.frame;
self.slidingViewController.topViewController = newTopViewController;
self.slidingViewController.topViewController.view.frame = frame;
[self.slidingViewController resetTopView];
于 2013-11-16T00:48:10.847 回答