MKPlacemark Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/MapKit.framework
Availability
Available in iOS 3.0 and later.
Companion guide
Declared in
MKPlacemark.h
Related sample code

Overview

A MKPlacemark object stores placemark data for a given latitude and longitude. Placemark data includes information such as the country, state, city, and street address associated with the specified coordinate. You can initialize a placemark using the initWithPlacemark: inherited method or the initWithCoordinate:addressDictionary: method specifying a coordinate and address dictionary.

A placemark is also an annotation and conforms to the MKAnnotation protocol, whose properties and methods include the placemark coordinate and other information. Because they are annotations, you can add them directly to the map view.

Tasks

Initializing a Placemark Object

Accessing the Placemark Attributes

Properties

countryCode

The abbreviated country name. (read-only)

@property(nonatomic, readonly) NSString *countryCode
Discussion

This string is the standard abbreviation used to refer to the country. For example, if the placemark location was Apple’s headquarters, the value for this property would be the string “US”.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h

Instance Methods

initWithCoordinate:addressDictionary:

Initializes and returns a placemark object using the specified coordinate and Address Book dictionary.

- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary
Parameters
coordinate

The map coordinate to associate with the placemark.

addressDictionary

A dictionary containing keys and values from an Address Book record. For a list of strings that you can use for the keys of this dictionary, see the “Address Property” constants in ABPerson Reference. All of the keys in should be at the top level of the dictionary.

Return Value

An initialized MKPlacemark object.

Discussion

You can create placemark objects manually for entities for which you already have address information, such as contacts in the Address Book. Creating a placemark object explicitly avoids the need to query the reverse geocoder object for the same information.

Availability
  • Available in iOS 3.0 and later.
Declared In
MKPlacemark.h