Need help with JMWhenTapped?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jakemarsh
202 Stars 26 Forks MIT License 43 Commits 2 Opened issues

Description

Easily assign touch down, touch up, and tapped actions to UIViews using blocks.

Services available

!
?

Need anything else?

Contributors list

# 66,574
Objecti...
carthag...
deep-li...
deeplin...
18 commits
# 22,552
Objecti...
carthag...
cocoapo...
tvos
15 commits
# 64,798
Objecti...
C
carthag...
cocoapo...
2 commits
# 24,177
Objecti...
Sketch
keyboar...
Xcode
1 commit
# 96,668
Objecti...
Shell
D
1 commit

What is it?

JMWhenTapped
is a simple little syntactical-sugar addition to all
UIView
objects, as well as any class that inherits from
UIView
. It allows you to assign touch-up, touch-down, tapped (touched down then up), double taps and two finger taps actions to a
UIView
object using a convenient blocks-style syntax. (Examples shown below).

Installation

Clone the repo. Add the

JMWhenTapped
folder to your iOS 4 project.
#import "JMWhenTapped.h"
wherever you'd like to use the syntax.

Examples & Usage

Use it like this:

[myView whenTapped:^{
    NSLog(@"I was tapped!");
}];

Or like this:

[myView whenTouchedDown:^{
    NSLog(@"I was touched down!");
}];

And also like this:

[myView whenTouchedUp:^{
    NSLog(@"I was touched up!");        
}];

This works the same way with double tap and two finger taps.

The Different Actions

The

whenTapped:
method should be used in cases where you simply want something to happen when the user taps on a view (i.e. you are concerned with performing some action when their finger is down then up, like changing to a "pressed" state.)

The

whenDoubleTapped:
method should be used when you want to check for double taps on your view.

The

whenTwoFingerTapped:
method should be used when you want to check for single taps made with two fingers (like in Maps.app).

The

whenTouchedDown:
method should be used when you want to trigger some action when the user touches down on your view.

The

whenTouchedUp:
method should be used when you want to trigger some action when the user touches up on your view.

Demo

Included in this repo is a demo Xcode project that illustrates a quick example of how to use

JMWhenTapped
.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.