我正在我的应用程序中实现 ECSlidingViewController
。一切正常,当我点击菜单按钮 (UIBar) 时,左侧菜单会滑动。但是再次按下菜单按钮不会返回当前的 ViewController
。
它在示例应用程序中工作,但我找不到带回当前 Controller 的那行代码。
这是显示菜单的代码:
- (IBAction)menuButtonTapped:(id)sender {
[self.slidingViewController anchorTopViewToRightAnimated:YES];
}
现在我到处寻找可以关闭左侧菜单布局但找不到的代码部分。它一定埋在某个地方......
如何通过按 Menu UIBar
按钮回到当前 View Controller ?
@Eric打开我的眼睛,看看是什么在执行那个事件。看起来 UIPanGestureRecognizer
负责重新显示主屏幕,不幸的是,在实现该委托(delegate)后我无法让它工作。
- (UIPanGestureRecognizer *)dynamicTransitionPanGesture {
if (_dynamicTransitionPanGesture) return _dynamicTransitionPanGesture;
_dynamicTransitionPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.transitions.dynamicTransition action:@selector(handlePanGesture:)];
return _dynamicTransitionPanGesture;
}
最佳答案
您可能正在寻找以下行:
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
在示例 TransitionFun 项目的 METransitionsViewController.m 中。
这控制了顶 View 在锚定到侧面时如何响应手势。 可以引用Anchored Top Views Gesture了解更多信息。
关于ios - 如何返回当前 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22308531/