Search code examples
iosobjective-cstoryboardmfslidemenu

How to set View Controller of MFSlideviewcontroller using storyBoard?


I am using MfSlideviewcontroller, i have to add some labels using storyboard but when i am using story board the viewcontroller will be blank. And when i am doing with the help of code it is showing but i dont know the autolayout using code. can Any one tell me how to use this in storyboard and why the screen is blank? in 5s it is shoing correct but in 6splus

enter image description here


Solution

  • Have you setup your viewcontroller similar to what is done in the example in the project?

    To use a storyboard, you'll need a viewcontroller and a splitviewcontroller.

    For the splitviewcontroller, follow what he has done in his example,

    1. Create MFMasterViewController and MFDetailViewController.
    2. Create the splitviewcontroller and set it's delegate to MFDetailViewController.
    3. Create MFSideMenuContainerViewController with SideMenuViewControllers for the left and right.

    For the viewcontroller, this is your initial viewcontroller or what you push to,

    1. Add MFSideMenuContainerViewController as a childviewcontroller.
    2. Add the view of MFSideMenuContainerViewController to the view of the viewcontroller.
    3. Setup constraints and call didMoveToParentViewController.

    Example code,

    [self addChildViewController:mfSideMenuContainerViewController];
    [self.view addSubview:mfSideMenuContainerViewController.view];  
    // setup all edge constraints
    [mfSideMenuContainerViewController didMoveToParentViewController:self];
    

    Hope this helps, ask me if you need me to clarify, good luck.