ECSlidingViewController 2从右向左滑动 [英] ECSlidingViewController 2 sliding from right to left
问题描述
是否可以使用ECSlidingViewController从右向左滑动菜单?默认值为从左到右
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];
}
推荐答案
这可以解决问题.
[self.slidingViewController resetTopViewAnimated:YES onComplete:^(){
[self.slidingViewController performSelectorOnMainThread:@selector(anchorTopViewToLeftAnimated:) withObject:nil waitUntilDone:NO];
}];
发生了什么事: ECSlidingViewContorller具有支持的不同过渡的枚举结构,并且不支持从锚点右移到锚点左移.这可能应该作为一项功能添加,并且应该创建一个问题.
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.
因此,您必须依次堆叠两个操作....但是,如果您查看代码,它将在更新其状态之前运行oncomplete.
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.
由于这应该在主线程中发生(因为它是一个UI事件),因此您可以向该线程中添加下一个动作,之后它实际上就会发生.
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.
这篇关于ECSlidingViewController 2从右向左滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!