Description
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:
- add one left navigation bar button ("Show Menu") for the center view controller
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
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)addLeftButtonForViewController:(UIViewController *)controller {
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];
}
} - (UIBarButtonItem *)leftButtonForCenterPanel {
return [[UIBarButtonItem alloc] initWithTitle:@"Show Menu" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleLeftFoldPanel:)];
} - (void)toggleLeftFoldPanel:(id)sender {
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.
- in IOS6, we will use pull down gesture to display (pull down from the status bar) the system notification center, right? but if user does not execute this gesture correctly, it will leak to an issue:
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.