O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drag Gesture Recognizer

Dragging a view is a continuous recognizer. The action method is called repeatedly as long as the finger is down and the recognizer is in an appropriate state. As explained earlier in this chapter, in the section “Custom Recognizers,” continuous recognizers have more states. Create your own continuous recognizer for dragging a view by following these steps:

1. Select the Other group in the Navigator and add the new class DragViewGesture, based on UIGestureRecognizer.

2. Import the gesture recognizer subclass:

#import <UIKit/UIGestureRecognizerSubclass.h>

3. Add the methods shown here:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {     [super ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required