ECSlidingViewController 2 sliding from right to left

孤人 提交于 2019-12-08 06:56:41

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/22332623/ecslidingviewcontroller-2-sliding-from-right-to-left

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!