Z
Z
Zaur Abdulgalimov2015-04-30 14:14:57
Objective-C
Zaur Abdulgalimov, 2015-04-30 14:14:57

How to catch a click in any area of ​​UIWindow?

The essence of the problem: It is necessary to record a video from the screen of a mobile phone so that it can be seen where the user clicks.
Question: Is it possible to catch the touchDown / touchUp events anywhere, even on top of other controls, but so that these controls also receive this event.
Or maybe there are already other solutions to this problem?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zaur Abdulgalimov, 2015-05-05
@abdulgalimov

Found this solution:

UIGestureRecognizer* tapper = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                                              action:@selector(handleSingleTap:)];
tapper.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:tapper];

- (void)handleSingleTap:(UITapGestureRecognizer *) sender {
    NSLog(@"handleSingleTap");
}

True, tap on the UIView background is not caught, but you can probably put some kind of control on the bottom layer and catch tap on it too ...

A
Alexander Shcherbakov, 2015-05-07
@mkll

Have a look at ready-made components on cocoacontrols, it doesn't always make sense to reinvent your own wheel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question