gpt4 book ai didi

ios - MKMapView 双击

转载 作者:行者123 更新时间:2023-11-28 19:53:57 28 4
gpt4 key购买 nike

以下是我的代码;我没有被 didDoubleTapMap 解雇。

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(didDoubleTapMap:)];
doubleTap.numberOfTapsRequired = 2;
doubleTap.numberOfTouchesRequired = 1;
[mkMapView addGestureRecognizer:doubleTap];


UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapOnMap:)];
singleTap.numberOfTapsRequired = 1;
singleTap.numberOfTouchesRequired = 1;


[singleTap requireGestureRecognizerToFail:doubleTap];

[mkMapView addGestureRecognizer:singleTap];

最佳答案

我想念的是,

doubleTap.delegate = self;
singleTap.delegate = self;

也不要忘记实现:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}

关于ios - MKMapView 双击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27572047/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com