I am integrating [ECSlidingViewController]
, which I found on github, in my app and I want to know if there is a property which tells me if the menu has been shown or not. I will be using this to control the functionality of the menu button, as a toggle to hide and show the menu. Is there any such property?
我在我的应用程序中集成了我在github上找到的[ECSlidingViewController],我想知道是否有一个属性告诉我菜单是否已显示。我将使用它来控制菜单按钮的功能,作为一个隐藏和显示菜单的切换。有这样的财产吗?
2 个解决方案
#1
6
Had the same issue, i'm sure there is a better way but I just did:
有同样的问题,我确信有更好的方法,但我刚刚做了:
- (IBAction)revealMenu:(id)sender
{
ECSlidingViewController *slidingViewController = self.slidingViewController;
if (slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionAnchoredRight) {
[slidingViewController resetTopViewAnimated:YES];
} else {
[slidingViewController anchorTopViewToRightAnimated:YES];
}
}
#2
0
I think the right approach would be to use the Anchored Top Views Gestures in order to control how the Top View behaves while it is anchored to the side.
我认为正确的方法是使用锚定顶视图手势来控制顶视图在锚定到侧面时的行为方式。
A common solution to create a toggle for showing and hiding the menu would be:
创建用于显示和隐藏菜单的切换的常见解决方案是:
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGesturePanning | ECSlidingViewControllerAnchoredGestureTapping;
Allowing the user to hide the menu using the Tap or the Pan gestures.
允许用户使用“点击”或“平移”手势隐藏菜单。
#1
6
Had the same issue, i'm sure there is a better way but I just did:
有同样的问题,我确信有更好的方法,但我刚刚做了:
- (IBAction)revealMenu:(id)sender
{
ECSlidingViewController *slidingViewController = self.slidingViewController;
if (slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionAnchoredRight) {
[slidingViewController resetTopViewAnimated:YES];
} else {
[slidingViewController anchorTopViewToRightAnimated:YES];
}
}
#2
0
I think the right approach would be to use the Anchored Top Views Gestures in order to control how the Top View behaves while it is anchored to the side.
我认为正确的方法是使用锚定顶视图手势来控制顶视图在锚定到侧面时的行为方式。
A common solution to create a toggle for showing and hiding the menu would be:
创建用于显示和隐藏菜单的切换的常见解决方案是:
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGesturePanning | ECSlidingViewControllerAnchoredGestureTapping;
Allowing the user to hide the menu using the Tap or the Pan gestures.
允许用户使用“点击”或“平移”手势隐藏菜单。