ios 单击和双击

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    //--------------------单击、双击----------------------

    UITouch *touch = [touches anyObject];

    NSUInteger tapCount = touch.tapCount;

    if (tapCount == 1) {

        [selfperformSelector:@selector(singleTap) withObject:nilafterDelay:0.2];//0.2或者0.3 根据自己的感官调整

    }

    else if(tapCount == 2) {

        

        [NSObjectcancelPreviousPerformRequestsWithTarget:selfselector:@selector(singleTap) object:nil];

        

        [self doubleTap];

    }

}

 加粗的方法就是双击和双击你要实现的功能的方法

posted @ 2013-05-17 18:31  墨禾米说  阅读(243)  评论(0编辑  收藏  举报