怪我咯2017-04-18 09:18:02
(void)touchesBegan:(NSSet
}
-(void)touchesEnded:(NSSet
}
-(void)touchesMoved:(NSSet
}
不知道題主是不是說的這個
迷茫2017-04-18 09:18:02
在 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寫法
如果是全域的話添加到AppDelegate.swift
如果是某個視圖的話添加到對應的ViewController.swift
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("开始触摸")
}
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("结束触摸")
}