ios中上下左右滑动的各种手势

//    定义手势

    UISwipeGestureRecognizer *recognizer;

    

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

    

    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];

    [[self view] addGestureRecognizer:recognizer];

    [recognizer release];

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

    

    [recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];

    [[self view] addGestureRecognizer:recognizer];

    [recognizer release];

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

    

    [recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];

    [[self view] addGestureRecognizer:recognizer];

    [recognizer release];

    

    

    recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

    [recognizer setDirection:(UISwipeGestureRecognizerDirectionDown)];

    [[self view] addGestureRecognizer:recognizer];

    [recognizer release];

    

    


你可能感兴趣的:(ios中上下左右滑动的各种手势)