0

The unwind segue to the menu view is no longer working on XCode 7 with iOS 9.

The only way I got it to "work" is by changing the type of segue in the storyboard to an ECSlidingSegue from the default UIStoryboardSegue. the ability to change this in the storyboard for unwind segues seems to be new to XCode 7. When changed to the ECSlidingSegue it only shows the menu view itself and the view it was supposed to shift to the right (but still keep on the screen) disappears. All other segues seem to be working and I can confirm that all was working correctly in iOS 8 and XCode 6.

Any ideas why this would not be working?

Community
  • 1
  • 1

3 Answers3

2

It looks like ECSlidingViewController hasn't been updated for a year now.

In some of my apps I am using MMDrawerController which seems to do exactly the same and I can confirm that it works with iOS 9. And it is updated on a more regular basis. If you are interested in trying it you can check it here

Andriy Gordiychuk
  • 6,163
  • 1
  • 24
  • 59
  • Thanks for the tip! will look into it and use as my last resort! considering it would be a very big job to change to MMDrawerController and i'm not experienced enough to take that on! – Chris Stuart Jun 30 '15 at 20:52
0

No, but until it's fixed, you can show the menu from code:

- (IBAction)menuButtonTap
{
    ECSlidingViewController *slidingViewController = (ECSlidingViewController *)self.view.window.rootViewController;
    [slidingViewController anchorTopViewToRightAnimated:YES];
}
  • how would i do this in swift? my menu button tapped function lies within the swift portion of my code in: @IBAction func unwindToMenuViewController(segue: UIStoryboardSegue) { } – Chris Stuart Jun 30 '15 at 20:50
  • figured out a kind of working swift solution. please check my next answer to make sure i'm not making a noob error.... – Chris Stuart Jun 30 '15 at 21:20
  • Your method `unwindToMenuViewController` is called when an unwind segue occurs. What I suggested is to not use unwind at all and instead just hook-up the menu button to an IBAction in code. You see your main screen reset because you're instantiating the ECSlidingViewController every time - no need to do that. Just get the rootViewController (which is the existing ECSlidingViewController instance) and call anchorTopViewToRightAnimated(true). – Tomas Stanik Jul 01 '15 at 21:16
  • Thanks Tomas! i will give that a go. – Chris Stuart Jul 03 '15 at 10:37
0
@IBAction func menuButtonTapped(sender: AnyObject) {
    let slidingViewController = self.view.window!.rootViewController as? ECSlidingViewController
    slidingViewController?.anchorTopViewToRightAnimated(true)
}

I managed to get it working correctly using swift by attaching each of the menu buttons in each of the view controllers to an IBAction function. I then put the code as it is above into each of these IBAction functions. The code uses the current instance of ECSlidingViewController (the current view) and then calls anchorTopViewToRightAnimated in order to correctly assign the current view that is being pulled to the right.