Raghav
Raghav

Reputation: 114

What's the difference between MKAnnotation and MKPointAnnotation. Why would I use one over the other?

In the documentation they look exactly the same, they can both take Coordinate, Title, and Subtitle.

Upvotes: 3

Views: 3794

Answers (2)

Gurjinder Singh
Gurjinder Singh

Reputation: 10329

@Sanjit has provided a good answer. But I want to add something. MKAnnotaion is a protocol. As I have attached screenshot below.

enter image description here

MKPointAnnotation is a class. It is Inherited from MKShape class and MKShape class implements MKAnnotaion protocol. Please refer below screenshot.

enter image description here

enter image description here

Upvotes: 0

Sonny Saluja
Sonny Saluja

Reputation: 7287

MKAnnotation is a protocol. Typically, you will create a NSObject subclass that implements this protocol. Instances of this custom class will then serve as your map annotation.

MKPointAnnotation is a class that implements MKAnnotation. You can use it directly if you want your own business logic on the annotation.

Upvotes: 8

Related Questions