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

Menu seems empty / transparent #216

Open Spoonrad opened 8 years ago

Spoonrad commented 8 years ago

Hi,

I'm at a complete loss and I could really use some help. There's something I must be doing wrong but I don't understand what.

The issue is that while I do have a right menu, and the slide animation works correctly, it shows what appears to be a completely transparent UIViewController. I have checked and my menu VC loads correctly, and when I do a modal segue for instance, everything is displayed correctly. My app works like this: there is an initial tab bar VC. One of the VC's tab leads to a SlideNavigationController (set in IB), which leads to a view controller. This view controller displays a menu on the right, instantiated from the storyboard.

This is how I configure things.

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // Side Menu
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];

    ReviserSideMenuViewController* sideMenu = [storyboard instantiateViewControllerWithIdentifier:@"ReviserSideMenuViewController"];
    [SlideNavigationController sharedInstance].rightMenu = sideMenu;

    [SlideNavigationController sharedInstance].menuRevealAnimationDuration = .18;
    [SlideNavigationController sharedInstance].menuRevealAnimator = [[SlideNavigationContorllerAnimatorSlideAndFade alloc] initWithMaximumFadeAlpha:.9 fadeColor:[UIColor blackColor] andSlideMovement:100];

/////
}

@interface ReviserViewController : UIViewController <SlideNavigationControllerDelegate>
//
@implementation ReviserViewController

- (BOOL)slideNavigationControllerShouldDisplayLeftMenu
{
    return NO;
}

- (BOOL)slideNavigationControllerShouldDisplayRightMenu
{
    return YES;
}

I would really appreciate some assistance if you have an idea why things aren't working for me. Thank you.

Screenshot below.

sc

Spoonrad commented 8 years ago

I have edited my code after following the issues related to "black screens" (basically my issue). So now, I put the code into the ViewController that should have a menu.

- (void) setupSideMenu
{   
    // Side Menu
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
    ReviserSideMenuViewController* sideMenu = [storyboard instantiateViewControllerWithIdentifier:@"ReviserSideMenuViewController"];
    [SlideNavigationController sharedInstance].rightMenu = sideMenu;
}

This still does not work. Should I set it at a different moment?

Edit:

I also tried putting the above methods in my tab bar view controller. No success though.

- (BOOL) tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
    if ([viewController isKindOfClass:[SlideNavigationController class]])
    {
       // SlideNavigationController* slideNavController = (SlideNavigationController*) viewController;
        // Side Menu
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
        ReviserSideMenuViewController* sideMenu = [storyboard instantiateViewControllerWithIdentifier:@"ReviserSideMenuViewController"];
        [SlideNavigationController sharedInstance].rightMenu = sideMenu;
    }

    return YES;
}

EDIT : I have been unable to follow the guidelines given in another issue on Tab Bar VCs successfully. I am giving up for now. Generally Tab Bar support seems very sketchy, unfortunately.