Created
June 18, 2015 15:44
-
-
Save Krumelur/353f7ca57d1010725c12 to your computer and use it in GitHub Desktop.
Shows how to detect any touch of the iOS screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Application | |
{ | |
// This is the main entry point of the application. | |
static void Main(string[] args) | |
{ | |
UIApplication.Main(args, typeof(CustomApplication), typeof(AppDelegate)); | |
} | |
} | |
// Inherits from UIApplication | |
public class CustomApplication : UIApplication | |
{ | |
// This gets called for various system events. | |
public override void SendEvent (UIEvent ev) | |
{ | |
base.SendEvent (ev); | |
//Check if the screen was touched. This will always be called, no matter what view controller is currently on screen. | |
UITouch anyTouch = ev.AllTouches != null ? ev.AllTouches.AnyObject as UITouch : null; | |
if(anyTouch != null && anyTouch.TapCount > 0 && anyTouch.Phase == UITouchPhase.Began) | |
{ | |
// TODO: Update some static variable or database value to store the current time of the touch | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment