2

I am making an app where the user has to double tap a segue to move to the next storyboard, but I cannot find anywhere where it tells you how to do this. Does anyone know how I can achieve this?

Ids Surrrrr
  • 49
  • 1
  • 6

2 Answers2

9

If you do this in Interface Builder with a storyboard:

  1. Drag a tap gesture recognizer from the object library onto your view.

    tap gesture

  2. Make sure the view you dragged it to has "user interaction enabled" checked.

    user interaction enabled

  3. Select the tap gesture you added to your scene (which you can find in your document outline on the left side of Interface Builder's main panel; this document outline can be collapsed where you can't see it ... if you don't see it, select "Show Document Outline" from the "Edit" menu).

    select gesture recognizer

  4. Change the number of taps from 1 to 2.

    taps

  5. control-drag from the tap gesture in the document outline to the next scene and choose your type of segue you want.

Frequently, people will create their gesture recognizers in code, so if you're interested in how that works, let me know.

Community
  • 1
  • 1
Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • thanks but I would like the user to double tap the add segue for it to change to the next storyboard?(the segue is in the embeded navigation bar) – Ids Surrrrr Aug 07 '13 at 20:46
  • @IdsSurrrrr With this, when you double tap on the view to which you've added this gesture recognizer, you'll be taken to the next scene on the current storyboard. I'm not sure if I understand your question because (a) you don't tap on "gestures" (which are an abstract object, not anything visible); and (b) you segue between scenes on a single storyboard, not between storyboards. Can you clarify? – Rob Aug 07 '13 at 20:48
  • Oh sorry, I understand what you mean now, but is there a way to only switch between the scene only if the user double taps on the segue? – Ids Surrrrr Aug 07 '13 at 20:54
  • @IdsSurrrrr Again, you don't technically tap on a gesture. You tap on a view to which you've added a gesture. And the above (attempted to) illustrate how you do that with IB. If you want to do it in code, let me know. – Rob Aug 07 '13 at 21:01
  • Ok so Ive got an add button in the navigation bar how do I make the user have to double press the add button to move to the next scene? – Ids Surrrrr Aug 07 '13 at 21:06
  • 1
    @IdsSurrrrr let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/35048/discussion-between-rob-and-ids-surrrrr) – Rob Aug 08 '13 at 01:25
  • 1
    Bottom line, using gesture recognizers is a hassle on bar buttons, so in that offline chat, I show an example of a simple `IBAction` for the bar button that will distinguish between single taps and double taps. – Rob Aug 08 '13 at 01:45
  • This helped me: Ensuring user interaction is enabled on the view that holds the gesture recognizer. – abc123 Dec 03 '14 at 04:14
1

Users do not interact with Segues and Storyboards in an app. Segues and Storyboards are tools that Apple provides within Xcode to aid in developing iOS apps.

If what you're asking is how to move to a new UIViewController once the user has double tapped a control (such as a UIButton), refer to this answer.

Community
  • 1
  • 1
hgwhittle
  • 9,316
  • 6
  • 48
  • 60