#import "SView.h" @implementation SView { int count; } - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } /**/ // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; if(touch.tapCount >=2){ //取消先前延时的操作 [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(clickCount) object:nil]; } count = touch.tapCount ; //延时执行统计方法 [self performSelector:@selector(clickCount) withObject:nil afterDelay:0.4]; } -(void)clickCount{ NSLog(@"%d",count); } @end
ios 判断用户触摸屏幕多少次
猜你喜欢
转载自01jiangwei01.iteye.com/blog/1851025
今日推荐
周排行