ECSlidingViewController在选择菜单项时删除Bounce Animation

时间:2013-10-15 13:47:22

标签: ios cocoa-touch animation ecslidingviewcontroller

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

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

修改

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];
    }];

2 个答案:

答案 0 :(得分: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。我希望你的问题能够得到解决。

答案 1 :(得分: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];