3

I am having trouble with setting up a basic ECSlidingViewController project.

I am using storyboards to set up my layout, but for the life of me I cannot get the unwind segue to work. When control dragging to the green exit button, it won’t allow me to make a connection.

Additionally, I cannot figure out how to add the pan gesture to the top view controller.

The transition fun example is the closest to what I am looking for (in regards to nag button to reveal menu and swiping the topViewController to reveal, as well as reset the top view controller when it is tapped) but I am having trouble picking apart the code.

Any insight on how to accomplish this?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Kyle Begeman
  • 7,169
  • 9
  • 40
  • 58

2 Answers2

18

ChrisSamuelson is right about the unwind segue.

As for the pan gesture, you add it using UIView's addGestureRecognizer:.

[self.slidingViewController.topViewController.view addGestureRecognizer:self.slidingViewController.panGesture]

You may need to add it to another view in the hierarchy, it depends on how your topViewController is setup and where you want the panning to be enabled.

To support swiping and tapping to reset the top view, make sure you configure sliding view controller like this

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
Michael Enriquez
  • 2,520
  • 21
  • 13
  • self.slidingViewController is not showing up as a valid property. I was able to control drag to the exit properly now but nothing work. I prefer the programatic method used in the Transition Fun example, but I have the same problem of self.slidingViewController not being a property. I do not see in the example where this is set up. I have made sure that my view controller conforms to the ECSlidingViewControllerDelegate – Kyle Begeman Nov 20 '13 at 23:19
  • 3
    Nevermind, forgot to add UIViewController+ECSlidingViewController.h! Thanks so much for your help! – Kyle Begeman Nov 20 '13 at 23:24
  • Hi Michael, i'm using the TransitionFun example, but i can't get swiping and tapping to reset the top view. I noticed you pointed out some configuration that must be done, but i don't realize where to add that. Here's the repo of my project https://bitbucket.org/agustinhaller/slidingpanels/src. Any help is appreciated. Thank you very much! – Agustin Haller Mar 06 '14 at 06:24
  • I know that the configuration i need is in this (http://goo.gl/8aXCJ7) chunk of code of the original TransitionFun example. But i don't know how to configure that in my HomeViewController (http://goo.gl/IkwEyw). Any help is appreciated. Thanks! – Agustin Haller Mar 06 '14 at 06:51
  • I manage to get things going. I changed my HomeViewController and now it's working. Here's what i've changed in case anyone needs it (https://gist.github.com/agustinhaller/9383946) – Agustin Haller Mar 06 '14 at 07:09
  • @Michael When i downloaded your code & try to run it, it is showing error "libPods-TransitionFun.a" not found, please let me know what should i do so it can work. I want to use fold navigation effect. Please suggest me what should i do ? – Nico Mar 28 '14 at 12:47
3

In order for you to make a connection to the green exit button in a view controller higher in your view controller hierarchy you need to have a method with this signature:

- (IBAction)yourUnwindMethodName:(UIStoryboardSegue*)sender 

where yourUnwindMethodName could be anything you choose. This method will appear when you attempt to make the connection to the green exit button.

Kara
  • 6,115
  • 16
  • 50
  • 57