如何处理屏幕底部的滑动手势

时间:2012-07-08 20:27:31

标签: objective-c ios

我有一个带有三个屏幕的应用程序,当用户从ipad屏幕底部向上滑动时,我想显示和隐藏一个小的uiview。我知道这不能用正常的滑动手势来降低。我想知道你是否可以告诉我如何处理这些滑动手势?

1 个答案:

答案 0 :(得分:5)

将UIPanGestureRecognizer添加到您的视图中。

-(void) panDetected:(UIGestureRecognizer *) gesture 
{    
    BOOL fromBottom = NO;
    CGPoint loc = [gesture locationInView:self.view];

    if(gesture.state == UIGestureRecognizerStateBegan)
    {                  
       if(loc is somewhere in the bottom of view)
            fromBottom = YES;
    }
    else if(gesture.state == UIGestureRecognizerStateChanged)
    {
        // You can up your view with finger movement here


    }
    else if(gesture.state == UIGestureRecognizerStateEnded)
    {

    }
}