MKAnnotation 和 MKPointAnnotation 有什么区别。为什么我要用一个而不是另一个?
What's the difference between MKAnnotation and MKPointAnnotation. Why would I use one over the other?
在文档中它们看起来完全一样,它们都可以采用 Coordinate、Title 和 Subtitle。
MKAnnotation
是一个协议。通常,您将创建一个实现此协议的 NSObject subclass。此自定义 class 的实例随后将用作您的地图注释。
MKPointAnnotation
是实现 MKAnnotation 的 class。如果你想在注解上有自己的业务逻辑,可以直接使用。
@Sanjit 给出了很好的答案。但我想补充一点。 MKAnnotaion 是一个 协议 。因为我在下面附上了屏幕截图。
MKPointAnnotation 是一个 class。它继承自MKShapeclass和MKShapeclass实现 MKAnnotaion 协议。请参考以下截图。
在文档中它们看起来完全一样,它们都可以采用 Coordinate、Title 和 Subtitle。
MKAnnotation
是一个协议。通常,您将创建一个实现此协议的 NSObject subclass。此自定义 class 的实例随后将用作您的地图注释。
MKPointAnnotation
是实现 MKAnnotation 的 class。如果你想在注解上有自己的业务逻辑,可以直接使用。
@Sanjit 给出了很好的答案。但我想补充一点。 MKAnnotaion 是一个 协议 。因为我在下面附上了屏幕截图。
MKPointAnnotation 是一个 class。它继承自MKShapeclass和MKShapeclass实现 MKAnnotaion 协议。请参考以下截图。