简体   繁体   English

对于Route-Me中RMMarker的子类,如何禁用用户交互?

[英]For my subclass of RMMarker in Route-Me, how do I disable user interaction?

I have a subclass of RMMarker which I want don't want receiving touches. 我有一个不想要接收触摸的RMMarker子类。 It receives touches that markers behind need to receive. 它接收后面的标记需要接收的触摸。 RMMarkers aren't UIViews, they're based on CALayers and the hit testing is done in RMMApView. RMMarkers不是UIViews,它们基于CALayers,并且命中测试是在RMMApView中完成的。 The only way I've thought of that seems like it will work is to change the hit test in RMMapView touchesEnded:withEvent, but I'm not even sure that would work, and it requires a nasty violation of modularity. 我想到的唯一可行的方法是更改​​RMMapView touchesEnded:withEvent中的命中测试,但我什至不确定是否可行,这需要对模块性的严格违反。 There's probably an easy way to do this that would involve overriding a method on RMMarker, but what? 可能有一种简单的方法可以覆盖RMMarker上的方法,但是呢?

Just overwrite this method on the subclass of a CALayer, and an instance of this subclass can't be clicked on. 只需在CALayer的子类上覆盖此方法,就不能单击该子类的实例。

- (BOOL)containsPoint:(CGPoint)thePoint
{
    return nil;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM