Skip to content
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

Bar buttons now update when changed #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gdisco
Copy link

@gdisco gdisco commented May 24, 2015

Love this subclass :). Had an issue while implementing it though: I created my SlideNavigationController using - initWithRootViewController (I don't use storyboards), and then I added a custom leftBarButtonItem, but the custom button wasn't showing up. I discovered that this is because the bar button items only update when a view controller is pushed onto the navigation stack. Since I was adding the custom button AFTER I added my root view controller, it wasn't getting updated. This patch overrides the setters on the bar button items such that they get updated whenever they're changed.

@aryaxt
Copy link
Owner

aryaxt commented Jul 2, 2015

Sorry been a while. Will look into this after I fix the landscape bug

@coolcool1994
Copy link

coolcool1994 commented Jun 21, 2017

Yeah I can confirm this bug. If I add leftBarButtonItem in Storyboard and set an action outlet and do [[SlideNavigationController sharedInstance] toggleLeftMenu];, the leftBarButtonItem wouldn't show up. Also if I add it in AppDelegate using code:

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[button setImage:[UIImage imageNamed:@"[email protected]"] forState:UIControlStateNormal];
[button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleLeftMenu) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
[SlideNavigationController sharedInstance].leftBarButtonItem = leftBarButtonItem;

This leftBarButton item also disappears. Only if you call above methods in viewdidload of a particular tabbar, the leftBarButtonItem would show up. This seems definitely like a bug.

@gdisco
Copy link
Author

gdisco commented Sep 7, 2017

Hey @aryaxt looks like this bug is still outstanding after all this time, and at least one other person would benefit from the fix! What do you say about merging in the pull request? Should be basically a no-op for you, github has verified there's no conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants