Re: [問題] 座標轉地址
※ 引述《winnie1103 (Winnie)》之銘言:
: 想請問一下以下兩個問題
: 第一
: 如果我已經使用CLLocation抓取到座標
: 那要怎麼讓座標轉地址?
: 我不需要地圖來顯示
: 只需要抓到一整串地址就可以了
最近剛好寫到..
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
CLGeocoder* geoCoder= [[CLGeocoder alloc]init];
[geoCoder reverseGeocodeLocation:newLocation completionHandler:
^(NSArray *placemarks, NSError *error) {
CLPlacemark *placemark = [placemarks objectAtIndex:0];
//修正, from http://ikevin.tw/333#more-333
//uranusjr 大大的這招比較好用(只需整組地址的話)
//取得地址字串
NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
}];
}
: 第二
: 在Xcode裡如何讓字串去做比較
: 並在寫好的PickerView中
: 自動選取對應的值?
: Ex:抓取到的值為-Blue
: 即自動選定PickerView中的Blue選項
: 並且顯示在對應的位置上(Label等)
: 謝謝!!!
一年多前有寫過
印象中是要自己比對並捲到該值
不知道是否有新作法
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.63.190
※ 編輯: Piceman 來自: 114.42.50.204 (11/01 15:28)
※ 編輯: Piceman 來自: 114.42.50.204 (11/01 23:28)
※ 編輯: Piceman 來自: 114.42.50.204 (11/01 23:29)
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章