我想实现我的滑动菜单的方式,按下菜单按钮将显示我的菜单和按下菜单将再次隐藏它。但我不知道如何用ECSlidingViewController来做这件事。会感谢你的帮助。
发布于 2013-12-27 15:06:49
ECSlidingViewController有这样的方法:anchorTopViewToRightAnimated:、anchorTopViewToLeftAnimated:和resetTopViewAnimated:。
在顶部视图控制器中的示例:
[self.slidingViewController anchorTopViewToRightAnimated:YES]ECSlidingViewController为添加此ECSlidingViewController属性的UIViewController提供了一个类别。
您还可能希望使用ECSlidingViewController的currentTopViewPosition来确定您的按钮是应该显示菜单还是在当前上下文中隐藏它。
发布于 2014-05-17 05:05:25
我已经提出了这个问题,上面的答案帮助我解决了这个问题。但是我只需要在代码示例中添加更详细的答案,这样如果其他人面临这样的问题,他们可能会从中受益。
- (IBAction)showSlidingMenu:(id)sender {
[self.slidingViewController anchorTopViewToRightAnimated:YES];
if ([self.slidingViewController currentTopViewPosition] == ECSlidingViewControllerTopViewPositionAnchoredRight) {
[self.slidingViewController resetTopViewAnimated:YES];
}
}+1用于提问和接受回答
谢谢。
发布于 2015-07-08 08:24:22
根据"ECSlidingViewController示例项目“,您需要将这4行放在ViewWillAppear of FirstTopController(例如TransitionViewController)中:
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];这4行正在表视图的委托方法中使用。您可能没有使用tableview,所以这4行代码没有调用。
最幸运的..。
https://stackoverflow.com/questions/20802064
复制相似问题