迷茫2017-04-18 09:18:02
Determine whether the current runloop is in tracking mode. If so, it means a finger is touching the screen
怪我咯2017-04-18 09:18:02
(void)touchesBegan:(NSSet<UITouch > )touches withEvent:(UIEvent *)event{
}
-(void)touchesEnded:(NSSet<UITouch > )touches withEvent:(UIEvent *)event {
}
-(void)touchesMoved:(NSSet<UITouch > )touches withEvent:(UIEvent *)event {
}
I don’t know if this is what the questioner is talking about
迷茫2017-04-18 09:18:02
Add the following method in AppDelegate.m
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
NSLog(@"开始触摸");
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
NSLog(@"结束触摸");
}
高洛峰2017-04-18 09:18:02
Swift writing method
If it is global, add it to AppDelegate.swift
If it is a certain view, add it to the corresponding ViewController.swift
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("开始触摸")
}
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("结束触摸")
}