Closed riyanpratamap closed 7 years ago
Do you mean avoid to open it when you are in ViewController B?
I am so sorry, it was sent before I finish asking my question. Now it's updated.
Use the delegate method:
- (BOOL)revealControllerPanGestureShouldBegin:(PBRevealViewController *)revealController direction:(PBRevealControllerPanDirection)direction
{
if (direction == PBRevealControllerPanDirectionRight) {
// if (other test) {
return NO;
// }
}
return YES;
}
I think I do not conform to PBRevealViewController delegate on ViewController B. I just want to avoid slidemenu to open in ViewController B, because it simply pure view controller.
Am I missed something here?
Do it in your main view controller (A). Adopt PBRevealViewController protocol, set the delegate to self and:
- (BOOL)revealControllerPanGestureShouldBegin:(PBRevealViewController *)revealController direction:(PBRevealControllerPanDirection)direction
{
if (direction == PBRevealControllerPanDirectionRight) {
UINavigationController *nc = (UINavigationController *)revealController.mainViewController;
if ([nc.topViewController isKindOfClass:[ViewControllerB class]]) {
return NO;
}
}
return YES;
}
You can also subclass PBRevealViewController. Generally I create a RevealViewController subclassing PBRevealViewController to handle the delegate methods I need to.
It works! Thank you!
Hi,
Is there any way to remove slidemenu after it pushed into some view controller? So, here is my hierarchy
NavController > ViewController A > ViewController B
I have table on ViewController A (which is view controller that hold slide menu). On every cell I pressed, I push into View Controller B with
[self performSegueWithIdentifier:idmenu[indexPath.row] sender:self];
Its slidemenu still appear if we swipe from left, and I want to disable it. Is there any way to do it? Thank you!