0

i am trying to call the viewDidLoad of view controllers only once while using SWRevealViewController.I am following these tutorial and want to do a little change loading the view controllers programmatically instead of using segues..

I tried to set the frontview controller in MenuController class as

class MenuController: UITableViewController {

  var navcontroller: UINavigationController?
    override func viewDidLoad() {
        super.viewDidLoad()

        navcontroller   = self.storyboard?.instantiateViewControllerWithIdentifier("pager") as? UINavigationController

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func viewWillAppear(animated: Bool) {

        println("ok this i get called")

    }



    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

        if indexPath.row == 2{

            if let temp = navcontroller{

            self.revealViewController().setFrontViewController(navcontroller!, animated: true)

            }else{

                println("navigation controller contains nil vaue")

            }


        }

    }

 }

The problem i get is i get black screen when i try to set the frontViewController once...Here is the work that i have done

1 Answers1

0

Actually everything was working fine just need another method to call

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

        if indexPath.row == 2{

            if let temp = navcontroller{

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

            }else{

                println("navigation controller contains nil vaue")

            }


        }

    }