Question

is there any way to use the ECSlidingViewController to slide the menu from right to left ? the default is left to right

this code is working, the menu slide from left to right:

- (IBAction)menuButtonTapped:(id)sender {
        [self.slidingViewController anchorTopViewToRightAnimated:YES];
}

this code is not working, i want the menu slide from right to left:

- (IBAction)menuButtonTapped:(id)sender {
        [self.slidingViewController anchorTopViewToLeftAnimated:YES];
}
Was it helpful?

Solution

This will do the trick.

  [self.slidingViewController resetTopViewAnimated:YES onComplete:^(){
    [self.slidingViewController performSelectorOnMainThread:@selector(anchorTopViewToLeftAnimated:) withObject:nil waitUntilDone:NO];
  }];

Here's whats happening: ECSlidingViewContorller has an enum struct of different transitions it supports, and it does not support sliding from anchor right, to anchor left. This, should likely be added as a feature, and an issue should be created.

So instead, you have to stack the two actions in sequence.... BUT, if you look at the code, it will run your oncomplete, before it has update its state.

Since this should be happening in the main thread (since its a UI event), you can add the next action to that thread and it will actually happen afterwards.

This will not work if you want to disable animation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top