UITapGestureRecognizerを利用してタッチイベントのモニタリング機能を実現する
コード下記:
– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITapGestureRecognizer *tapGe = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleGesture:)];
tapGe.cancelsTouchesInView = NO;
[self.window addGestureRecognizer:tapGe];
return YES;
}
– (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer {
NSLog(@"Touched");
}