首頁(yè)完成改版,來(lái)提意見(jiàn)
iphone獲取地址的詳細(xì)信息
- (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:@獲取詳細(xì)信息失敗
message:errormessage
delegate:nil
cancelbuttontitle:@ok
otherbuttontitles:nil];
[alertview show];
[alertview release];
}
- (void)reversegeocoder:(mkreversegeocoder *)geocoder didfindplacemark:(mkplacemark *)placemark
{
nslog(@%@,placemark.locality);
}
//=======================================================
street = 科韻路 18號(hào)
thoroughfare = 科韻路
subthoroughfare = 18號(hào)
city = 廣州市
sublocality = 天河區(qū)
state = 廣東省
subadministrativearea = (null)
zip = (null)
country = 中國(guó)
{
city = 廣州市;
country = 中國(guó);
countrycode = cn;
formattedaddresslines = (
中國(guó),
廣東省廣州市天河區(qū),
科韻路18號(hào)
);
state = 廣東省;
street = 科韻路18號(hào);
sublocality = 天河區(qū);
subthoroughfare = 18號(hào);
thoroughfare = 科韻路;
}
mkplacemark:
@property (nonatomic, readonly) nsdictionary *addressdictionary; //地址字典
@property (nonatomic, readonly) nsstring *thoroughfare; //街道名——“科韻路”
@property (nonatomic, readonly) nsstring *subthoroughfare; // 門(mén)牌號(hào)——“18號(hào)”
@property (nonatomic, readonly) nsstring *locality; //城市——“廣州市”
@property (nonatomic, readonly) nsstring *sublocality; //區(qū)縣——“天河區(qū)”
@property (nonatomic, readonly) nsstring *administrativearea; //身份——“廣東省”
@property (nonatomic, readonly) nsstring *subadministrativearea; //沒(méi)獲取到,不知道是什么東東
@property (nonatomic, readonly) nsstring *postalcode; //郵政編碼——不知道是什么原因,這里沒(méi)獲取到
@property (nonatomic, readonly) nsstring *country; //國(guó)家——“中國(guó)”
@property (nonatomic, readonly) nsstring *countrycode; //國(guó)家代碼——“cn”
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄
2025國(guó)考·省考課程試聽(tīng)報(bào)名