0

I am using the SWRevealViewController library for a side menu within my main view. I am trying to perform a segue from the main view (the one with the Nav Bar I want to be passed over to the next view) instead on the rear view (the one with the menu table), so I am trying to perform a segue using that view controller instead of 'self'. However, I am getting an error saying that the segue with identifier does not exist (it does).

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

    switch indexPath.row {
    case 0:
        print("case 0")
        ViewController().goToView("to_playlist")
        break
    default:
        break
    }
}

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UITableViewDataSource, UITableViewDelegate {
    func goToView(a: String) {
        performSegueWithIdentifier(a, sender: self)
    }
}

Can somebody please let me know how I can do this?

Thanks.

Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75

2 Answers2

1

Don't forget to set identifier from the StoryBoard:

//objc code
SettingsController *view = [[SettingsController alloc] init];
view.blahBlah = self.blah;
[self.navigationController pushViewController:view animated:YES];
ZGski
  • 2,398
  • 1
  • 21
  • 34
Halid
  • 448
  • 7
  • 16
0

am also using SwRevealViewController. This arraiangement will work to get the desired behaviour. check you are missing Navigation controller (How you are setting main viewcontroller. there you are making mistake i think) in the mainView thats why you are not able to navigate.enter image description here

ask me you have any other queries.Hope this will help you.

karthik
  • 621
  • 4
  • 14
  • Thank you.. I am now having the problem that the nav bar is also on the rear controller. Do you have any idea how I can have it be only over the front one? – Jacobo Koenig May 24 '16 at 03:27
  • do you want to push from main view right ? then only choice is to create one NavController. embed in mainview. this is the only choice you can make to perform segue.i will post u the code if possible – karthik May 24 '16 at 03:53
  • Thank you.. That is what I was doing. But since the navigation table is on the rear controller, the nav bar does not transfer to the following views! – Jacobo Koenig May 25 '16 at 14:13
  • fine. Happy coding – karthik May 25 '16 at 14:17