2014-04-01 83 views

回答

2

可以使用UIPanGestureRecognizer,然後用translationInView找出用戶的手指多少移動通過,並更新你的觀點。因此

UIPanGestureRecognizer* pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; 
[self.view addGestureRecognizer:pan]; 

而且處理:

-(void)handlePan:(UIPanGestureRecognizer*)sender 
{ 
    CGFloat yMovement = [sender translationInView:sender.view].y; 
    // Do something with the movement 

    // Then reset the translation 
    [sender setTranslation:CGPointZero inView:sender.view]; 
} 
+0

謝謝,是,藉此我能夠製造這個系統。 – user2058653