Reputation: 121
I am working on an application where I need to detect 3 tap anywhere on iPhone device. I know we can detect tap on iPhone screen but this time I need to detect everywhere on iPhone device such as iPhone backside.
Upvotes: 2
Views: 804
Reputation: 247
For recognizing taps on the back of the phone you could try to evaluate the acceleration sensor's data. But in order to get significant accelerations, the user must tap quite hard.
Upvotes: 1
Reputation: 49730
you get 3 Tap at Iphone screen everywhere in your app(not for iphone all app) of UIView you just need to implement code in EachViewController ViewdidLoad
method like:-
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 3;
[self.view addGestureRecognizer:tapGesture];
[tapGesture release];
}
- (void)handleTapGesture:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateRecognized) {
// handling code
}
}
you can do this stuff for only your crated app not for backside(Iphone Device).
Upvotes: 1
Reputation: 11643
You can use UITapGestureRecognizer
for detecting tap gesture on iPhone screen.
It has numberOfTapsRequired
for number of taps count and numberOfTouchesRequired
for tapping fingers count.
And we couldn't know whether user tap on iPhone backside. :(
Upvotes: 0