aryaxt / iOS-Slide-Menu

iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Other
1.52k stars 359 forks source link

Can't add title to navigation item of the left menu #101

Closed pbassut closed 9 years ago

pbassut commented 9 years ago

How can I set the title of my viewcontroller using Slide-Menu?

I've tried:

self.title = @"my title";
self.navigationItem.title = @"my title";
self.navigationController.title = @"my title";
self.navigationController.navigationItem.title = @"Title";

Some of them don't even make much sense, but I tried it anyway.

aryaxt commented 9 years ago

Do you have any sample? The code below should work, you should also be able to do it in the storyboard

self.title = @"my title";

pbassut commented 9 years ago

I'll try to make a sample now.

pbassut commented 9 years ago

@aryaxt I push my viewcontrollers like this:

        MenuViewController *menuVC = [self.storyboard instantiateViewControllerWithIdentifier:@"menuVC"];
        ProductsViewController *productsVC = [self.storyboard instantiateViewControllerWithIdentifier:@"productsVC"];
        [productsVC setResources:result];

        SlideNavigationController *navigationController = (SlideNavigationController *)[self.storyboard instantiateViewControllerWithIdentifier:@"mainNavigationController"];
        navigationController.enableSwipeGesture = YES;
        navigationController.leftMenu = menuVC;
        [navigationController pushViewController:productsVC animated:YES];

Is there any problem with this?

aryaxt commented 9 years ago

No that should work, do you have a title set for the viewcontorller in your storyboard?

pbassut commented 9 years ago

@aryaxt in that case the MenuViewController? No, I don't. Only an empty navigation Item.

I had to manually create a navigationBar by using a view on the top of my view's viewcontroller because the SlideMenu doesn't even show de navigationBar.

Before I thought it was the navigationBar but it was only a view. Sorry about that.

aryaxt commented 9 years ago

Wrap MenuViewController inside a UINavigationCotnroller, and instead of setting the menuVC as leftMenu set the navigationController as your leftMenu.

Or I guess what you did works too