Reputation: 259
I want to make an application that it capture all touch events and display x,y value in toolbar。
Upvotes: 2
Views: 4010
Reputation: 80633
Neither of your goals can be accomplished on a non-jailbroken device (and probably not even on a rooted one), because it violates the spirit of the Application Sandbox.
Upvotes: 2
Reputation: 3429
1) You can capture touch events when your own app is running is pretty easy. One way would be to a single root view controller, implement
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
If you really are interested in displaying their coordinates, you will also have to think about questions like what happens in cases of multitouch.
However,
This is not possible for other apps. 2) is not possible at all. You don't have access to the status bar and you will not be able to do anything like capturing touch events when the application is in the background anyway. You can only capture events when your application is in the foreground.
Upvotes: 4