Detecting Touches
May 7th, 2009
To detect whether a touch has been performed on the screen, you just have to add a function to your view controller, this is helpful when you just want someone to touch the screen rather than a button:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"The View Has Been Touched"); }
Even better, it will only call the touchesBegan function once the the view we put the touchesBegan function in gets touched. I usually use the touchesBegan in place of buttons in an app that has an activation function (ie. Touch the screen to activate.).