首頁完成改版,來提意見
iphone獲取地址的詳細信息
- (id)initwithcoordinate:(cllocationcoordinate2d)coordinate {
if (self = [super init]) {
// custom initialization
reversegeocoder = [[mkreversegeocoder alloc] initwithcoordinate:coordinate];
reversegeocoder.delegate = self;
[reversegeocoder start];
//……
}
return self;
}
#pragma mark mkreversegeocoderdelegate
- (void)reversegeocoder:(mkreversegeocoder *)geocoder didfailwitherror:(nserror *)error
{
nsstring *errormessage = [error localizeddescription];
uialertview *alertview = [[uialertview alloc] initwithtitle:@獲取詳細信息失敗
message:errormessage
delegate:nil
cancelbuttontitle:@ok
otherbuttontitles:nil];
[alertview show];
[alertview release];
}
- (void)reversegeocoder:(mkreversegeocoder *)geocoder didfindplacemark:(mkplacemark *)placemark
{
nslog(@%@,placemark.locality);
}
//=======================================================
street = 科韻路 18號
thoroughfare = 科韻路
subthoroughfare = 18號
city = 廣州市
sublocality = 天河區(qū)
state = 廣東省
subadministrativearea = (null)
zip = (null)
country = 中國
{
city = 廣州市;
country = 中國;
countrycode = cn;
formattedaddresslines = (
中國,
廣東省廣州市天河區(qū),
科韻路18號
);
state = 廣東省;
street = 科韻路18號;
sublocality = 天河區(qū);
subthoroughfare = 18號;
thoroughfare = 科韻路;
}
mkplacemark:
@property (nonatomic, readonly) nsdictionary *addressdictionary; //地址字典
@property (nonatomic, readonly) nsstring *thoroughfare; //街道名——“科韻路”
@property (nonatomic, readonly) nsstring *subthoroughfare; // 門牌號——“18號”
@property (nonatomic, readonly) nsstring *locality; //城市——“廣州市”
@property (nonatomic, readonly) nsstring *sublocality; //區(qū)縣——“天河區(qū)”
@property (nonatomic, readonly) nsstring *administrativearea; //身份——“廣東省”
@property (nonatomic, readonly) nsstring *subadministrativearea; //沒獲取到,不知道是什么東東
@property (nonatomic, readonly) nsstring *postalcode; //郵政編碼——不知道是什么原因,這里沒獲取到
@property (nonatomic, readonly) nsstring *country; //國家——“中國”
@property (nonatomic, readonly) nsstring *countrycode; //國家代碼——“cn”
更多信息請查看IT技術專欄