Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have implemented the ECSlidingViewController framework to my project. That works. I can switch between my Viewcontrollers with the left side menu.
But now I want to set the current view / top view by clicking a 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;            
}];

When I click this button, the newView-ViewController is on top, but the left menu is also visible. I've tried everything like the following to hide the menu:

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

How can I hide the left menu?

Sorry for my english mistakes, I'm from Germany.

share|improve this question

2 Answers 2

Don't keep using self.slidingViewController during the whole process. It is evaluated each time so when you change the view controllers in the sliding controller you can break the link. So, cache the sliding controller reference and reuse it:

ECSlidingViewController *slidingViewController = self.slidingViewController;

[slidingViewController ...];
[slidingViewController ...];
share|improve this answer

Calling resetTopView at the end of the onComplete block should hide the menu.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.