作者Piceman (派斯面)
看板MacDev
标题Re: [问题] 座标转地址
时间Thu Nov 1 02:19:58 2012
※ 引述《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)