[IOS实例小计]UIImageView(3)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-17 09:44 点击:次
p> doubleFingerTwo.numberOfTapsRequired = 2;
p> doubleFingerTwo.delegate= self;
p>
p> //如果不加下面的话,当单指双击时,会先调用单指单击中的处理,再调用单指双击中的处理
p> [singleFingerOne requireGestureRecognizerToFail:singleFingerTwo];
p> //同理双指亦是如此
p> [doubleFingerOne requireGestureRecognizerToFail:doubleFingerTwo];
p>
p> [self.view addGestureRecognizer:singleFingerOne];
p> [self.view addGestureRecognizer:singleFingerTwo];
p> [self.view addGestureRecognizer:doubleFingerOne];
p> [self.view addGestureRecognizer:doubleFingerTwo];
p>
p> [singleFingerOne release];
p> [singleFingerTwo release];
p> [doubleFingerOne release];
p> [doubleFingerTwo release];
p>处理事件的方法,代码:
p> //处理单指事件
p>- (void)handleSingleFingerEvent:(UITapGestureRecognizer *)sender
p>{
p>if(sender.numberOfTapsRequired == 1) {
p>//单指单击
p>NSLog(@"单指单击");
p> }elseif(sender.numberOfTapsRequired == 2){
p>//单指双击
p>NSLog(@"单指双击");
p>}
p> }
p> //处理双指事件
p> - (void)handleDoubleFingerEvent:(UITapGestureRecognizer *)sender
p> {
p> if(sender.numberOfTapsRequired == 1) {
p> //双指单击
p> NSLog(@"双指单击");
p> }elseif(sender.numberOfTapsRequired == 2){
p> //双指双击
p> NSLog(@"双指双击");
p> }
p> }
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>