Inherits from UIPanGestureRecognizer
Declared in TKMoveGestureRecognizer.h
TKMoveGestureRecognizer.m

Overview

TKMoveGestureRecognizer is a pan-gesture-recognizer built to move a view between certain locations.

Properties

animating

A flag that indicates if the movable view is moving to a resting location.

@property (nonatomic, readonly) BOOL animating

Declared In

TKMoveGestureRecognizer.h

axis

The directions the movable can go.

@property (nonatomic, readonly) TKMoveGestureAxis axis

Declared In

TKMoveGestureRecognizer.h

canMoveOutsideLocationBounds

If YES, it keeps the view within the location bounds. Otherwise NO.

@property (nonatomic, assign) BOOL canMoveOutsideLocationBounds

Declared In

TKMoveGestureRecognizer.h

locations

Resting locations for the movable view.

@property (nonatomic, strong) NSArray *locations

Declared In

TKMoveGestureRecognizer.h

movableView

The view that the gesture will move.

@property (nonatomic, strong) UIView *movableView

Declared In

TKMoveGestureRecognizer.h

moveHandler

The callback of the gesture-recognizer.

@property (nonatomic, copy, setter=setMoveHandler, :) void ( ^ ) ( TKMoveGestureRecognizer *gesture , CGPoint position , CGPoint location ) moveHandler

Declared In

TKMoveGestureRecognizer.h

moving

A flag that indicates if the gesture is active.

@property (nonatomic, readonly) BOOL moving

Declared In

TKMoveGestureRecognizer.h

snapBackAnimation

The POPSpringAnimation used to animate the movable view to a resting place.

@property (nonatomic, strong) POPSpringAnimation *snapBackAnimation

Declared In

TKMoveGestureRecognizer.h

velocityDamping

Reduces the velocity used to determine the resting location after a gesture.

@property (nonatomic, assign) CGFloat velocityDamping

Declared In

TKMoveGestureRecognizer.h

Class Methods

gestureWithAxis:movableView:

Creates and returns a gesture recognizer to move a view between points.

+ (instancetype)gestureWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

gestureWithAxis:movableView:locations:

Creates and returns a gesture recognizer to move a view between points.

+ (instancetype)gestureWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView locations:(NSArray *)locations

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

locations

An array of locations that the view can move to. If the axis is X&Y, then the array should contain NSValue objects with a CGPoint. Otherwise, it should an array of NSNumbers.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

gestureWithAxis:movableView:locations:moveHandler:

Creates and returns a gesture recognizer to move a view between points.

+ (instancetype)gestureWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView locations:(NSArray *)locations moveHandler:(void ( ^ ) ( TKMoveGestureRecognizer *gesture , CGPoint position , CGPoint location ))block

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

locations

An array of locations that the view can move to. If the axis is X&Y, then the array should contain NSValue objects with a CGPoint. Otherwise, it should an array of NSNumbers.

block

A callback block for the gesture-recognizer.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

Instance Methods

initWithAxis:movableView:

Creates and returns a gesture recognizer to move a view between points.

- (instancetype)initWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

initWithAxis:movableView:locations:

Creates and returns a gesture recognizer to move a view between points.

- (instancetype)initWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView locations:(NSArray *)locations

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

locations

An array of locations that the view can move to. If the axis is X&Y, then the array should contain NSValue objects with a CGPoint. Otherwise, it should an array of NSNumbers.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

initWithAxis:movableView:locations:moveHandler:

Creates and returns a gesture recognizer to move a view between points.

- (instancetype)initWithAxis:(TKMoveGestureAxis)axis movableView:(UIView *)movableView locations:(NSArray *)locations moveHandler:(void ( ^ ) ( TKMoveGestureRecognizer *gesture , CGPoint position , CGPoint location ))block

Parameters

axis

The directions the movable can move in.

movableView

The view that the gesture will move.

locations

An array of locations that the view can move to. If the axis is X&Y, then the array should contain NSValue objects with a CGPoint. Otherwise, it should an array of NSNumbers.

block

A callback block for the gesture-recognizer.

Return Value

A newly minted move-gesture-recognizer.

Declared In

TKMoveGestureRecognizer.h

moveToPoint:

Animates the movable view to a certain point.

- (void)moveToPoint:(CGPoint)point

Parameters

point

The point the movable view will relocate to.

Declared In

TKMoveGestureRecognizer.h