質問

iOS6 Apple MapKit

So I understand the code in the link below for the most part. http://phpadvocate.com/blog/2013/01/ios-6-1-simple-example-using-mklocalsearch/

However, how do I get the address for the mapItem? Seems like the other properties include: placemark, isCurrentLocation, name, phoneNumber, and url.

http://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapItem_class/MKMapItem_class.pdf

Basically, once the data is fetched, I'd like to display the name of the retail location as the cell.text and the address as cell.detailText.

役に立ちましたか?

解決

mapItem.placemark.thoroughfare.copy, // Will return first single line address

mapItem.placemark.locality, // Will return City

mapItem.placemark.administrativeArea //Will return State.

Below are some more:

CLPlacemark | Property Meaning

Thoroughfare | Street address. First line if multiple lines.

subThoroughfare | Street address, second line (e.g., apartment or unit number, box number)

Locality | City

SubLocality | This might contain a neighborhood or landmark name, though it’s often nil

administrativeArea | State, province, territory, or other similar unit

dministrativeArea | County

postalCode | ZIP code

Country | Country

countryCode | Two-digit ISO country code

他のヒント

To correct the "correct answer", the subThoroughfare doesn't contain apartment number or unit number, it is the house number.

Apartment number is in subPremise, which I do not know how to retrieve yet.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top