1

我已经在ECSlidingViewController我的项目中实现了框架。这样可行。我可以使用左侧菜单在我的视图控制器之间切换。
但现在我想通过单击来设置当前视图/顶视图UIButton

NSString *identifier = [NSString stringWithFormat:@"%@", @"newView"];

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

当我单击此按钮时,newView- ViewController位于顶部,但左侧菜单也可见。我已经尝试了以下所有方法来隐藏菜单:

[self.slidingViewController anchorTopViewTo:ECRight];
...
self.slidingViewController.underRightWidthLayout = ECVariableRevealWidth;
...
[self.slidingViewController anchorTopViewTo:ECLeft];
...
[self.slidingViewController anchorTopViewOffScreenTo:ECLeft];
...
self.slidingViewController.underLeftWidthLayout = ECFullWidth;
...
[self.slidingViewController resetTopView];

如何隐藏左侧菜单?

对不起我的英语错误,我来自德国。

4

3 回答 3

0

self.slidingViewController整个过程不要一直使用。每次都会对其进行评估,因此当您更改滑动控制器中的视图控制器时,您可以断开链接。因此,缓存滑动控制器引用并重用它:

ECSlidingViewController *slidingViewController = self.slidingViewController;

[slidingViewController ...];
[slidingViewController ...];
于 2013-08-20T10:35:25.560 回答
0

resetTopView在 onComplete 块末尾调用应该隐藏菜单。

于 2013-11-16T01:44:53.133 回答
0

显示/隐藏 SlideViewController

[viewController.slidingViewController anchorTopViewToRightAnimated:YES];
    if ([viewController.slidingViewController currentTopViewPosition] == ECSlidingViewControllerTopViewPositionAnchoredRight) {
        [viewController.slidingViewController resetTopViewAnimated:YES];
    }
于 2015-02-17T06:50:29.203 回答