0

Scenario:

I have a MainViewController, TableViewController and DetailsViewController of (TableViewController)

I am using Open Source Library to obtain Sliding menu functionality the tutorial can be found here: Sliding menu with ENSideMenuNavigationController

When I applied this tutorial to my project I could easily obtained sliding menu as I wanted and you can from the image

When I click on Second View a TableViewController appears with the list data and Here the Issue starts when I select a row it navigates to details view controller and when I come back from detailsviewcontroller to TableViewController sliding menu wont open again.

Here is my TableViewController didSelectRowAtIndexPath code:

      switch (indexPath.section) {

        case 0:


            if (self.myInvoicesUnPaid.isEmpty){

             self.displayAlertMessage("Ödenmemiş faturanız bulunmamaktadır.")

            } else if (!self.myInvoicesUnPaid.isEmpty){

                // Get Cell Label
                let indexPath = tableView.indexPathForSelectedRow;

                //let currentCell = tableView.cellForRowAtIndexPath(indexPath!) as UITableViewCell!;

                let storyboard = UIStoryboard(name: "Main", bundle: nil)

                let viewController = storyboard.instantiateViewControllerWithIdentifier("viewControllerIdentifer") as! invoiceDetailsViewController

                viewController.passedValue = self.myUnpaidInvoicesDetails[(indexPath?.row)!]

                viewController.isPaid = false

                self.presentViewController(viewController, animated: true , completion: nil)




            }


        break

        case 1:

            // Get Cell Label
            let indexPath = tableView.indexPathForSelectedRow;

            let storyboard = UIStoryboard(name: "Main", bundle: nil)

            let viewController = storyboard.instantiateViewControllerWithIdentifier("viewControllerIdentifer") as! invoiceDetailsViewController

            viewController.passedValue = self.myPaidInvoicesDetails[(indexPath?.row)!]

            viewController.isPaid = true




            self.presentViewController(viewController, animated: true , completion: nil)



        break

        default: break

  }  

Here is the detailsViewController code when I navigate back to my TableViewController

 func backButtonPressed (sender:UIButton!){


        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyboard.instantiateViewControllerWithIdentifier("InvoicesTableViewController") as! InvoicesTableViewController
        vc.navigationController?.navigationBarHidden = false

        vc.navigationController?.setNavigationBarHidden(false, animated:true)

        performSegueWithIdentifier("backToMyInvoices", sender: self)


    }

The last piece of my code represents the tutorial code which comes from ENSideMenuNavigationController

class SlideNavigationController: ENSideMenuNavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.

        let storyBoard = UIStoryboard(name: "Main", bundle: nil)

       let menu =  storyBoard.instantiateViewControllerWithIdentifier("LeftSideViewController") as! LeftSideMenuTableView

        sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menu, menuPosition: ENSideMenuPosition.Left )
        sideMenu?.menuWidth = 220

        view.bringSubviewToFront(navigationBar)

    }

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





    }

Please any help will be appreciated.. It has been a couple of weeks I am stack

Serhan Khan
  • 1
  • 1
  • 3

1 Answers1

0

I'm using this Sliding Menu and I'm able to have it throughout the entire app.. Even after a ViewController pop.

Initialize ENNavigationViewController (there is an example in the "Example" folder that you can use) with your root view controller - MainViewController.

When you want to present the next View Controller:

self.navigationController?.pushViewController(...)

or use the method that's present on the ENSlideMenuNavigation controller in the example:

setContentViewController(contentViewController: UIViewController)

LopesFigueiredo
  • 146
  • 1
  • 8