2012年3月26日
摘要: 用Automatic Gesture Recognition实现十分简单- (void)viewDidLoad{ [super viewDidLoad]; UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(doPinch:)]; [self.view addGestureRecognizer:pinch];}- (void)doPinch:(UIPinchGestureRecognizer *)pinch... 阅读全文
posted @ 2012-03-26 11:13 老Zhan 阅读(497) 评论(2) 推荐(0) 编辑
摘要: 用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 ... 阅读全文
posted @ 2012-03-26 10:43 老Zhan 阅读(681) 评论(0) 推荐(0) 编辑
摘要: - (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 ... 阅读全文
posted @ 2012-03-26 10:06 老Zhan 阅读(1001) 评论(0) 推荐(0) 编辑
摘要: iphone上的手势操作有许多种,包括轻击、触摸、拖动、轻扫等。开发中与四个方法有很大关联:–touchesBegan:withEvent:–touchesMoved:withEvent:–touchesEnded:withEvent:–touchesCancelled:withEvent:四个方法的参数都是(NSSet *) touches 及(UIEvent *)event。touches 中的每一个对象都是一个UITouch事件。NSUInteger numTaps = [[touches anyObject] tapCount]; NSUInteger numTouches = ... 阅读全文
posted @ 2012-03-26 09:53 老Zhan 阅读(433) 评论(0) 推荐(0) 编辑