-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forever loop in unfoldLeftView #8
Comments
The root cause should be
1)PaperFoldMenuController: showMenu:animated because the self.paperFoldInitialPanDirection is set as PaperFoldInitialPanDirectionVertical Fix: ??set the self.paperFoldInitialPanDirection as PaperFoldInitialPanDirectionHorizontal before invoking animateWithContentOffset:panned method. // unfold the left view
Further InvestigationI am not sure if there would be some smilar issues for unfoldTopView or button view or right view, but you can use the similar solution to fix it. This only happens when invoking the PaperFoldView:: setPaperFoldState: method, because we directly re-used the last self.paperFoldInitialPanDirection value which is set in the onContentViewPanned method, and this value is obsolete. For the pan to show top/bottom/left/right view, there is no such issue, because the self.paperFoldInitialPanDirection is updated each time. |
Wow. Thanks. Let me read this... and get back to you, |
Do u have a sample project u can send me? |
I created a resp, try https://github.com/flypigz/PaperFoldMenuController-Forever-Loop, test step
|
FYI I ran into the exact same problem... the fix proposed by @flypigz solved the issue. |
Actually this is an issue of PaperFold, but I can reproduce it easily with this PaperFoldMenuController demo.
Issue reproduce percentage: 100%
Issue reproduce steps using the demo project:
1.1 update two methods below in PaperFoldMenuController.m
(void)setViewControllers:(NSMutableArray *)viewControllers
{
self.selectedIndex = NSNotFound; // Forces any child view controller to be removed.
_viewControllers = viewControllers;
if ([_viewControllers count]>0) [self setSelectedIndex:0];
[self reloadMenu];
// add top left button
for (UIViewController *controller in _viewControllers) {
[self addLeftButtonForViewController:controller];
}
}
(void)addViewController:(UIViewController*)viewController;
{
if (!_viewControllers) _viewControllers = [NSMutableArray array];
[self.viewControllers addObject:viewController];
[self reloadMenu];
// add top left button
[self addLeftButtonForViewController:viewController];
}
1.2 add below methods in PaperFoldMenuController.m
pragma mark
pragma mark - Bar Button Action
///////////////////////////////////////////////////////////////////////////////////////////////////
UIViewController *rootViewController = controller;
if ([rootViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController *nav = (UINavigationController *)rootViewController;
//nav.navigationBar.tintColor = [UIColor colorWithHex:0xf1a0f8];
if ([nav.viewControllers count] > 0) {
rootViewController = [nav.viewControllers objectAtIndex:0];
}
}
if (!rootViewController.navigationItem.leftBarButtonItem) {
rootViewController.navigationItem.leftBarButtonItem = [self leftButtonForCenterPanel];
}
}
return [[UIBarButtonItem alloc] initWithTitle:@"Show Menu" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleLeftFoldPanel:)];
}
NSLog(@"%s", PRETTY_FUNCTION);
[self showMenu:YES animated:YES];
}
after this, you can use the "Show menu" button to show the left menu, but you can't use it to hide the left menu with above code.
2.1 put one finger in the Navigation bar of center view controller
2.2 pull down you finger but DO NOT exceed the bounds of the navigation bar (i.e. limit you pull down gesture in the navigation bar)
2.3 press the "Show Menu" bar button, which will invoke "[self showMenu:YES animated:YES];" method, but it won't work any more, and it will loop in the PaperFoldView::unfoldLeftView method forever....
I guess this happens because you capture the pull down gesture in somewhere, maybe this happens after you merged the code of PaperFold top and bottom fold feature (not sure if this feature has been merged to the main branch of PaperFold), and it break the codes.
Please msg me if you have any question about the issue reproduction.
Thanks in advanced.
The text was updated successfully, but these errors were encountered: