摘要:
用Automatic Gesture Recognition实现十分简单- (void)viewDidLoad{ [super viewDidLoad]; UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(doPinch:)]; [self.view addGestureRecognizer:pinch];}- (void)doPinch:(UIPinchGestureRecognizer *)pinch... 阅读全文
摘要:
用Automatic Gesture Recognition实现:在viewDidLoad中- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self ... 阅读全文
摘要:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; gestureStartPoint = [touch locationInView:self.view];}- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPosition ... 阅读全文
摘要:
iphone上的手势操作有许多种,包括轻击、触摸、拖动、轻扫等。开发中与四个方法有很大关联:–touchesBegan:withEvent:–touchesMoved:withEvent:–touchesEnded:withEvent:–touchesCancelled:withEvent:四个方法的参数都是(NSSet *) touches 及(UIEvent *)event。touches 中的每一个对象都是一个UITouch事件。NSUInteger numTaps = [[touches anyObject] tapCount]; NSUInteger numTouches = ... 阅读全文