当前位置:编程学习 > wap >>

轻扫(swipe)手势

- (void)viewDidLoad
{
    [super viewDidLoad];
	
    /*instantiate the object */
    UISwipeGestureRecognizer *swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];
    /*Swipes that are performed from right to left are to be detected*/
    swipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
    /*just one finger needed*/
    swipeGestureRecognizer.numberOfTouchesRequired = 1;
    /*add it to the view*/
    [self.view addGestureRecognizer:swipeGestureRecognizer];
}


-(void)handleSwipes:(UISwipeGestureRecognizer *)paramSender{
    NSLog(@"swipe to left");
}

 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,