最近开发一款ipad应用,需要根据所在位置不同优先显示不同地区的数据,像墨迹天气一样,网上例子不少,这里粘个代码备份一下:
#pragma mark -
#pragma mark CLLocationManagerDelegate
- (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];
NSLog(@"name:%@\n country:%@\n postalCode:%@\n ISOcountryCode:%@\n ocean:%@\n inlandWater:%@\n locality:%@\n subLocality:%@ \n administrativeArea:%@\n subAdministrativeArea:%@\n thoroughfare:%@\n subThoroughfare:%@\n",
placemark.name,
placemark.country,
placemark.postalCode,
placemark.ISOcountryCode,
placemark.ocean,
placemark.inlandWater,
placemark.administrativeArea,
placemark.subAdministrativeArea,
placemark.locality,
placemark.subLocality,
placemark.thoroughfare,
placemark.subThoroughfare);
}];
if (wasFound) return;
wasFound = YES;
CLLocationCoordinate2D loc = [newLocation coordinate];
strLatitude = [NSString stringWithFormat: @"%f", loc.latitude];
strLongitude = [NSString stringWithFormat: @"%f", loc.longitude];
NSLog(@"strLatitude==%@,strLongitude==%@",strLatitude,strLongitude);
}
用于显示当前设备所在地区的相关信息,也可以使用经纬度进行查询
使用CLLocationCoordinate2D coordinate;
coordinate.latitude = 42.611681;
coordinate.longitude = 144.161324;
CLLocation *newLocation=[[CLLocation alloc]initWithLatitude:coordinate.latitude longitude: coordinate.longitude];
CLGeocoder *geocoder=[[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:newLocation
completionHandler:^(NSArray *placemarks, NSError *error)
代替
CLGeocoder *geocoder=[[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:newLocation
completionHandler:^(NSArray *placemarks,
NSError *error)
即可。
相关推荐
丝印 代码 反查 维修 开发设计 手册
五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具 五笔反查工具
原创、绿色程序,不需安装。输入单个汉字或短文,程序能将正确的拼音查询出来。对于生僻的汉字,可以通过拼音输入法(应为支持编码反查... 输入法反查功能,更可以对五笔等其它输入法反查。 欢迎大家多提意见,谢谢。
五笔反查五笔反查五笔反查五笔反查五笔反查五笔反查
五笔反查五笔反查五笔反查五笔反查五笔反查五笔反查五笔反查
2015代码丝印反查标记手册
批量BOM反查 SAP PP MRP,似类于CS15,但CS15只能逐个的查。
一般来说,根据芯片丝印,,是硬件工程师的一项必备技能。现在也多了一些这方面的网站,例如什么“芯片反查网”之类的。本文仅供参考。
通过IP地址可以查找到IP下绑定的所有域名。 西安紫微软件工作室开发 www.ziweisoft.com www.ziweisoft.cn
五笔字型反查代码工具 五笔字型反查代码工具
86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具86&98五笔反查工具
86版王码五笔反查工具,支持偏旁、拼音查询。
可以反查五笔字根,很是方便
该工具集成8位CRC校验所需功能:【正向校验】、【查表法】、【生成校验】、【反查】;可应用于CAN通讯中的CRC校验参数配置
五笔反查工具.rar 五笔反查工具.rar 五笔反查工具.rar 五笔反查.rar 五笔反查.rar
该文档为贴片二极管,三级管,场效应管,复位芯片等贴片代码反查
五笔反查精灵-反查五笔编码 五笔反查精灵-反查五笔编码 五笔反查精灵-反查五笔编码
SMD-codes 贴片丝印大全 2012版,丝印反查23万种SMD芯片 二极管,三极管,LDO,MOS管等丝印查询,可以通过丝印反查器件型号
Chrome 插件,反查微博图片po主