0

I'm working with revealViewController, and inside this revealViewController I wanted to create a UITableView with custom cells according to this tutorial: https://www.youtube.com/watch?v=EVJiprvRLoo

and here is my code:

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let vcName = identities[indexPath.row]
let viewController = storyboard?.instantiateViewControllerWithIdentifier(vcName)
self.navigationController?.pushViewController(viewController!, animated: true)
}

I'm using a storyboard, but I didn't get any issues, but it's not working.

I also tried to make a push segue to that view controller, but then my navigationViewController disappears, and I think it's would be easier by using code.

Sorry if my question is not accurate, but hope you can understand it.

Many Thanks.

tbilopavlovic
  • 1,096
  • 7
  • 13
Cs.John
  • 31
  • 7

2 Answers2

0

Your self.navigationController? is nil. You should do something like this:

let vcName = identities[indexPath.row]
let viewController = storyboard?.instantiateViewControllerWithIdentifier(vcName)
let navVC = UINavigationController(rootViewController:viewController)

and then set front view controller by method of SWRevealViewController:

- (void)pushFrontViewController:(UIViewController *)frontViewController animated:(BOOL)animated;

self.revealViewController.pushFrontViewController(navVC, animated:true)

tbilopavlovic
  • 1,096
  • 7
  • 13
0

You have to push to the RevealController Not to the ViewController

praveen kumar
  • 141
  • 10