0

I found the AKSwiftSlideMenu code to create a slide menu. The example works great.

I figured out how to add more item in the side menu, but when I click on the new items it will take me to my new viewcontroller but I don't have the '3 LINED MENU ICON' on the top.

SEE LINK TO VC3 BELOW case 0: print("Home\n", terminator: "")

        self.openViewControllerBasedOnIdentifier("Home")

        break
    case 1:
        print("Play\n", terminator: "")

        self.openViewControllerBasedOnIdentifier("PlayVC")

        break
    case 2:
        print("x\n", terminator: "")

        self.openViewControllerBasedOnIdentifier("VC3")

        break
    default:
        print("default\n", terminator: "")
    }
}

What are the steps to add a new VC3, I know how to add a new vc to the main storyboard, but can't seem to get the new vc to have the navigation bar and the '3 line menu' at the top of my new VC.

thanks

user6804473
  • 165
  • 2
  • 2
  • 6
  • how you connecting your newVC with segue or no segue. – Joe Nov 04 '16 at 13:05
  • check my update.... – Joe Nov 04 '16 at 13:58
  • If my answer helped you to resolve the issue.You must accept my answer. Thats the way system works.so, we both get benefit from it otherwise no point helping your post and wasting my own time ? – Joe Nov 05 '16 at 02:55
  • Accept my answer man.I felt like wasted my time helping you? – Joe Nov 07 '16 at 01:17

1 Answers1

0

Try this code:

Note: Below code has to go inside your BaseViewController.Make sure you set segue identifier and destinatinViewController on all viewController.

    func slideMenuItemSelectedAtIndex(index: Int32) {
    let topViewController : UIViewController = self.navigationController!.topViewController!

    switch(index){
    case 0:
        print("VC1\n", terminator: "")
        self.performSegueWithIdentifier("segueVC1", sender: nil)

        func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.performSegueWithIdentifier("segueVC1", sender: nil)
        segue.destinationViewController as! viewControllerOne
        }
        break

    case 1:
        print("VC2", terminator: "")
        self.performSegueWithIdentifier("segueVC2", sender: nil)

        func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.performSegueWithIdentifier("segueVC2", sender: nil)
        segue.destinationViewController as! viewControllerTwo    
        }
        break

    case 2:
        print("VC3", terminator: "")
        self.performSegueWithIdentifier("segueVC3", sender: nil)

        func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.performSegueWithIdentifier("segueVC3", sender: nil)
        segue.destinationViewController as! viewControllerThree      
        }
        break

    case 3:
        print("VC4", terminator: "")   
        self.performSegueWithIdentifier("segueVC4", sender: nil)

        func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.performSegueWithIdentifier("segueVC4", sender: nil)
        segue.destinationViewController as! viewControllerFour   
        }
        break

       default:
        print("default\n", terminator: "")
    }

Note : If you not using segue to connect VC's then you need a different approach.let me know.

Update:

Step1: Create a swift class for your newVC.

Step2: Drag newVC to your storyBoard and setup a custom class name.(newVc class name and VC custom class name should be match)

Step3: Connect AKSwiftSlideMenuVC to newVC and give name to your segueIdentifier.

Step 4: Goto BaseViewController update your case segueIdentifier and destVC...

Joe
  • 8,868
  • 8
  • 37
  • 59
  • Thanks, how do I connect a new VC in the storyboard to a sequel, I guess where do I exactly drag and drop to/from to the new VC and making sure it has the navigation bar in the new vc – user6804473 Nov 04 '16 at 13:40