iOS Developer Library

Developer

UIKit Framework Reference UIRotationGestureRecognizer Class

Options
Deployment Target:

On This Page
Language:

UIRotationGestureRecognizer

Inheritance


Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 3.2 and later.

UIRotationGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for rotation gestures involving two touches. When the user moves the fingers opposite each other in a circular motion, the underlying view should rotate in a corresponding direction and speed.

Rotation is a continuous gesture. It begins when two touches have moved enough to be considered a rotation. The gesture changes when a finger moves while the two fingers are down. It ends when both fingers have lifted. At each stage in the gesture, the gesture recognizer sends its action message.

  • rotation rotation Property

    The rotation of the gesture in radians.

    Declaration

    Swift

    var rotation: CGFloat

    Objective-C

    @property(nonatomic) CGFloat rotation

    Discussion

    You may set the rotation value to an arbitrary value; however, setting the rotation resets the velocity.

    The rotation value is a single value that varies over time. It is not the delta value from the last time that the rotation was reported. Apply the rotation value to the state of the view when the gesture is first recognized—do not concatenate the value each time the handler is called.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.2 and later.

  • velocity velocity Property

    The velocity of the rotation gesture in radians per second. (read-only)

    Declaration

    Swift

    var velocity: CGFloat { get }

    Objective-C

    @property(nonatomic, readonly) CGFloat velocity

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.2 and later.