barndog
barndog

Reputation: 7163

Annotations, Annotations, Annotations

So `MKAnnotation's. Fun stuff.

My questions:

What's the difference between an annotation's title and its subtitle and how does that affect the visual component of the annotation?

What's the difference between a MKPinAnnotationView and a MKAnnotationView? Are there different types of map annotations in iOS apart from pins?

Upvotes: 2

Views: 295

Answers (2)

iPatel
iPatel

Reputation: 47059

Title is main heading of your pin.

The subtitle is actually displaying the address/(common info) of the dropped pin.You can store other deeply information of related to title that is puted on pin.

enter image description here

MKAnnotation is a protocol you need to adopt if you wish to show your object on a MKMapView. The coordinate property tells MKMapView where to place it. title and subtitle properties are optional but if you wish to show a callout view you are expected to implement title at a minimum.

MKAnnotationView visually presents the MKAnnotation on the MKMapView. The image property can be set to determine what to show for the annotation. However you can subclass it and implement drawRect: yourself.

MKPinAnnotationView is a subclass of MKAnnotationView that uses a Pin graphic as the image property. You can set the pin color and drop animation.

Don't forget about the leftCalloutAccessoryView and the rightCalloutAccessoryView properties of MKAnnotationView that can be used to customize the callout view.

Upvotes: 3

The title and subtitle are displayed when a pin is selected on the map. The subtitle simply falls below the title.

MKPinAnnotationView is simply an specialized form of MKAnnotationView that knows how to draw a pin (and a shadow) and also allows setting the pin color. It's the only built-in annotation view with an image, you have to make your own if you want something different (but it's very easy to do).

Upvotes: 1

Related Questions