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

Keep existing button items from current UINavigationItem #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions SlideMenu/Source/SlideNavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,23 @@ - (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([self shouldDisplayMenu:MenuLeft forViewController:viewController])
viewController.navigationItem.leftBarButtonItem = [self barButtonItemForMenu:MenuLeft];
if ([self shouldDisplayMenu:MenuLeft forViewController:viewController]) {
UIBarButtonItem* leftMenuButton = [self barButtonItemForMenu:MenuLeft];
// Add menu button to the left of the navigationItems buttons
NSArray* leftBarButtonItems = viewController.navigationItem.leftBarButtonItems;
leftBarButtonItems = [@[leftMenuButton] arrayByAddingObjectsFromArray:leftBarButtonItems];

viewController.navigationItem.leftBarButtonItems = leftBarButtonItems;
}

if ([self shouldDisplayMenu:MenuRight forViewController:viewController])
viewController.navigationItem.rightBarButtonItem = [self barButtonItemForMenu:MenuRight];
if ([self shouldDisplayMenu:MenuRight forViewController:viewController]) {
UIBarButtonItem* rightMenuButton = [self barButtonItemForMenu:MenuRight];
// Add menu button to the right of the navigationItems buttons
NSArray* rightBarButtonItems = viewController.navigationItem.rightBarButtonItems;
rightBarButtonItems = [rightBarButtonItems arrayByAddingObject:rightMenuButton];

viewController.navigationItem.rightBarButtonItems = rightBarButtonItems;
}
}

- (CGFloat)slideOffset
Expand Down