MDCInkTouchController

@interface MDCInkTouchController : NSObject <UIGestureRecognizerDelegate>

MDCInkTouchController associates a MDCInkView with a UIGestureRecognizer to control the spread of the ink.

Subclasses should avoid overriding the UIGestureRecognizerDelegate gestureRecognizerShouldBegin: and gestureRecognizer:shouldReceiveTouch: methods to avoid breaking MDCInkTouchControllerDelegate.

NOTE: The controller does not keep a strong reference to the view to which it is attaching an ink view. It is expected that the view will keep a strong reference to its own ink controller, or that the view controller controlling the view will keep a strong reference to that view’s ink controller.

  • Weak reference to the view that responds to touch events.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) UIView *view;
  • The ink view for clients who do not create their own ink views via the delegate.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull) MDCInkView *defaultInkView;
  • Delegate to extend the behavior of the touch control.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<MDCInkTouchControllerDelegate>
        delegate;
  • If YES, the gesture recognizer should delay the start of ink spread. Default is NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL delaysInkSpread;
  • The distance that causes the recognizer to cancel. Defaults to 20pt.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat dragCancelDistance;
  • Whether dragging outside of the view causes the gesture recognizer to cancel. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL cancelsOnDragOut;
  • If enabled, the ink gesture will require failure of UIScrollView gesture recognizers in order to activate.

    Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL requiresFailureOfScrollViewGestures;
  • Bounds inside of which the recognizer will recognize ink gestures, relative to self.view.frame.

    If set to CGRectNull (the default), then the recognizer will use self.view.bounds as the target bounds.

    If cancelsOnDragOut is YES and the user’s touch moves beyond the target bounds inflated by dragCancelDistance then the gesture is cancelled.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGRect targetBounds;
  • Gesture recognizer used to bind touch events to ink.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull)
        MDCInkGestureRecognizer *gestureRecognizer;
  • Unavailable, please use initWithView: instead.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Initializes the controller.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithView:(nonnull UIView *)view;

    Parameters

    view

    View that responds to touch events for ink.

  • When called the @c defaultInkView is added to the @c view.

    This method is a no-op when the delegate conforms to @c inkTouchController:inkViewAtTouchLocation: because this is how a client specifies a custom ink view.

    If you want to specify a specific z-index order for your inkView please conform to @c inkTouchController:insertInkView:intoView: and do so there.

    Declaration

    Objective-C

    - (void)addInkView;
  • Cancels all touch processing and dissipates the ink.

    This is useful if your application needs to remove the ink on scrolling, when preparing a view for reuse, etc.

    Declaration

    Objective-C

    - (void)cancelInkTouchProcessing;
  • Returns the ink view at a particular touch location.

    If the delegate responds to @c inkTouchController:inkViewAtLocation: then this method queries it. Otherwise, if @c addInkView has been called and @c location is in the bounds of @c self.defaultView, then that view is returned. If none of these conditions are met, @c nil is returned.

    Declaration

    Objective-C

    - (MDCInkView *_Nullable)inkViewAtTouchLocation:(CGPoint)location;

    Parameters

    location

    The query location in the coordinates of @c self.view.

    Return Value

    The ink view at the touch location, or nil.