Contents

translation(in:)

Interprets the pan gesture in the coordinate system of the specified view.

Declaration

func translation(in view: UIView?) -> CGPoint

Parameters

  • view:

    The view in whose coordinate system the translation of the pan gesture should be computed. If you want to adjust a view’s location to keep it under the user’s finger, request the translation in that view’s superview’s coordinate system.

Mentioned in

Return Value

A point identifying the new location of a view in the coordinate system of its designated superview.

Discussion

The x and y values report the total translation over time. They aren’t delta values from the last time that the translation was reported. Apply the translation value to the state of the view when the gesture is first recognized — don’t concatenate the value each time the handler is called.

See Also

Tracking the location and velocity of the gesture