标签:color rop else atomic ble encoding nbsp elf get
//设定一个实例变量存储手指之间的其起始距离 @property (assign, nonatomic) CGFloat initialFontSize; //调用: UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizeralloc] initWithTarget:selfaction:@selector(doPinch:)]; [self.viewaddGestureRecognizer:pinch]; //实现方法: - (void)doPinch:(UIPinchGestureRecognizer *)pinch { if (pinch.state == UIGestureRecognizerStateBegan) { initialFontSize = label.font.pointSize;//开始时的 } else { label.font = [label.fontfontWithSize:initialFontSize * pinch.scale]; } }
//调用: UITapGestureRecognizer *singleTap = [[UITapGestureRecognizeralloc] initWithTarget:self action:@selector(tap1)]; singleTap.numberOfTapsRequired = 1; singleTap.numberOfTouchesRequired = 1; [self.viewaddGestureRecognizer:singleTap]; UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizeralloc] initWithTarget:self action:@selector(tap2)]; doubleTap.numberOfTapsRequired = 2; doubleTap.numberOfTouchesRequired = 1; [self.viewaddGestureRecognizer:doubleTap]; [singleTap requireGestureRecognizerToFail:doubleTap]; //这句是最主要的 UITapGestureRecognizer *tripleTap = [[UITapGestureRecognizeralloc] initWithTarget:self action:@selector(tap3)]; tripleTap.numberOfTapsRequired = 3; tripleTap.numberOfTouchesRequired = 1; [self.viewaddGestureRecognizer:tripleTap]; [doubleTap requireGestureRecognizerToFail:tripleTap]; UITapGestureRecognizer *quadrupleTap = [[UITapGestureRecognizeralloc] initWithTarget:self action:@selector(tap4)]; quadrupleTap.numberOfTapsRequired = 4; quadrupleTap.numberOfTouchesRequired = 1; [self.viewaddGestureRecognizer:quadrupleTap]; [tripleTap requireGestureRecognizerToFail:quadrupleTap]; //不同点击触发的事件: - (void)tap1 { singleLabel.text = @"Single Tap Detected"; [selfperformSelector:@selector(eraseMe:) withObject:singleLabelafterDelay:1.6f]; } - (void)tap2 { doubleLabel.text = @"Double Tap Detected"; [selfperformSelector:@selector(eraseMe:) withObject:doubleLabelafterDelay:1.6f]; } - (void)tap3 { tripleLabel.text = @"Triple Tap Detected"; [selfperformSelector:@selector(eraseMe:) withObject:tripleLabelafterDelay:1.6f]; } - (void)tap4 { quadrupleLabel.text = @"Quadruple Tap Detected"; [selfperformSelector:@selector(eraseMe:) withObject:quadrupleLabelafterDelay:1.6f]; } //清除内容 - (void)eraseMe:(UILabel *)label { label.text = @""; }
标签:color rop else atomic ble encoding nbsp elf get
原文地址:https://www.cnblogs.com/ios-wmm/p/10215963.html