#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch * touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
NSLog(@"x = %f y = %f",point.x,point.y);
}
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"事件打断");
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"触摸结束");
UITouch * touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
NSLog(@"x = %f y = %f",point.x,point.y);
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"触摸移动");
UITouch * touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
NSLog(@"x = %f y = %f",point.x,point.y);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end