0

I am using xcode 4.2. Here is my herarchy

Navigation COntroller (No toolbars) -> ViewController1 -> ViewController2 -> ViewController3 ->ViewController4

I have added swipe gestures in 1-3 Controllers and have used push using Left Swipe.

Now This is one direction only. How can i do it bi-directional. I want to go to ViewController1 from ViewController4. I have tried adding another SwipeGesture assigning right but it don't work. Any ideas?

Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193

2 Answers2

0

You might look into this post Setting direction for UISwipeGestureRecognizer Besides this, if you receive the notification you can see in which controller you are and if you in controller 1 and it is a left swipe push controller 4 onto the stack. But beware of the fact that we are talking about a stack. So every time you push a controller the stack grows. It might be to have your controllers initiated on first use and than keep a reference. You can bring the corresponding view into place if you detect a swipe.

Community
  • 1
  • 1
Bernd Rabe
  • 790
  • 6
  • 23
0

Setting the direction property of UISwipeGestureRecognizer and using the bit wise operator with different directions should work.

There are existing questions on this. It's well explained there.

How to recognize swipe in all 4 directions?

Setting direction for UISwipeGestureRecognizer

Community
  • 1
  • 1
mvb
  • 701
  • 1
  • 11
  • 20