2

I'm working for a IOS9+ project using swift , using the same slide menu (Which is done programmatically) to translate between view controllers as shown in the link : Slide Menu and it working fine

the problem is it's using storyboard ID for each view controller in the function addChildView():

 func addChildView(storyBoardID: String, titleOfChildren: String, iconName: String) {

let childViewToAdd: UIViewController = storyboard!.instantiateViewControllerWithIdentifier(storyBoardID)
tabOfChildViewController += [childViewToAdd]
tabOfChildViewControllerName += [titleOfChildren]
tabOfChildViewControllerIconName += [iconName]

menuToReturn.append(["title":titleOfChildren, "icon":iconName])
}

which is called in TransitionBetweenTwoViews function :

func transitionBetweenTwoViews(subViewNew: UIViewController){

//Add new view
addChildViewController(subViewNew)
subViewNew.view.frame = (self.parentViewController?.view.frame)!
view.addSubview(subViewNew.view)
subViewNew.didMoveToParentViewController(self)

 //Remove old view
 if self.childViewControllers.count > 1 {

 //Remove old view
 let oldViewController: UIViewController = self.childViewControllers.first!
 oldViewController.willMoveToParentViewController(nil)
 oldViewController.view.removeFromSuperview()
 oldViewController.removeFromParentViewController()
 }

 print("After Remove: \(self.childViewControllers.description)")
 }

that is called in the delegate of the BaseViewController Class

My problem is that I'm not using storyboard instead a nib file for each view controller , how could i do it without storyboard I have been searching for days to find solution but nothing work
Also the tableView of the menu is a table with sections

Please if you have any solution that could help it will be appreciated or any other slide menu that work with nib files

Edit : Slide Menu table View : screen shot of slide menu with section so if i choose Flight Availability or Ticket Balance it will be like i choose home with index 0 how could i solve that ?

  • Use the `MyViewController(nibName:)` initialiser - http://stackoverflow.com/questions/30316257/loading-uiviewcontroller-from-nib-file – Paulw11 Jun 19 '16 at 08:07
  • how could it define the selected nib view controller ? – Raghdah maq Jun 19 '16 at 08:11
  • I don't understand your question. If you want a `MyChildVC1` you say `let childViewToAdd = MyChildVC1(nibName:"mychildVC")` - substituting class names and nib names as appropriate – Paulw11 Jun 19 '16 at 08:13
  • Thanks a lot it work fine but i still have problem with selection – Raghdah maq Jun 19 '16 at 08:39

0 Answers0