当前位置: 首页 > news >正文

app和手机网站的区别是什么浙江省网站icp备案

app和手机网站的区别是什么,浙江省网站icp备案,平面设计图片 作品集,西夏区建设交通网站iOS系统自带定位#xff0c;用CLLocationManager就可以轻松的实现定位的操作#xff0c;获得的是一组经纬度#xff0c;当然#xff0c;也可以根据给出的经纬度获取相应的省份、城市、街道等信息#xff0c;下面就看一个根据经纬度获得城市的demo#xff1a;因为获取经纬…         iOS系统自带定位用CLLocationManager就可以轻松的实现定位的操作获得的是一组经纬度当然也可以根据给出的经纬度获取相应的省份、城市、街道等信息下面就看一个根据经纬度获得城市的demo        因为获取经纬度需要CLLocationManager类而这个类包含在CoreLocation框架中获取城市信息需要mapKit框架所以需要首先在工程中导入这两个框架导入框架的步骤选择1.target——2.Build Phases——3.Link Binary With Libraries ——4.点击“”号如图所示步骤点击加号之后在搜索框里输入相应的框架即可搜索到如图所示下面就该写代码了首先在视图控制器中导入#import CoreLocation/CoreLocation.h #import MapKit/MapKit.h两个头文件然后.m中的具体代码如下#import ANNViewController.hinterface ANNViewController () property (strong, nonatomic) IBOutlet UILabel *longitude; property (strong, nonatomic) IBOutlet UILabel *latitude;property (strong, nonatomic) IBOutlet UILabel *location; property (strong, nonatomic) CLLocationManager *locationManager;endimplementation ANNViewController- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.self.view.backgroundColor  [UIColor whiteColor];//创建CLLocationManager对象self.locationManager  [[CLLocationManager alloc] init];//设置代理为自己self.locationManager.delegate  self;} - (IBAction)locationButton:(UIButton *)sender {[self.locationManager startUpdatingLocation]; }- (void)locationManager:(CLLocationManager *)managerdidUpdateToLocation:(CLLocation *)newLocationfromLocation:(CLLocation *)oldLocation {//将经度显示到label上self.longitude.text  [NSString stringWithFormat:%lf, newLocation.coordinate.longitude];//将纬度现实到label上self.latitude.text  [NSString stringWithFormat:%lf, newLocation.coordinate.latitude];// 获取当前所在的城市名CLGeocoder *geocoder  [[CLGeocoder alloc] init];//根据经纬度反向地理编译出地址信息[geocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *array, NSError *error){if (array.count  0){CLPlacemark *placemark  [array objectAtIndex:0];//将获得的所有信息显示到label上self.location.text  placemark.name;//获取城市NSString *city  placemark.locality;if (!city) {//四大直辖市的城市信息无法通过locality获得只能通过获取省份的方法来获得如果city为空则可知为直辖市city  placemark.administrativeArea;}NSLog(city  %, city);}else if (error  nil  [array count]  0){NSLog(No results were returned.);}else if (error ! nil){NSLog(An error occurred  %, error);}}];//系统会一直更新数据直到选择停止更新因为我们只需要获得一次经纬度即可所以获取之后就停止更新[manager stopUpdatingLocation]; }主要就是直辖市的城市获得需要拐个弯iOS7添加了一个新的方法代替了上面这个方法- (void)locationManager:(CLLocationManager *)managerdidUpdateLocations:(NSArray *)locations {NSLog(longitude  %f, ((CLLocation *)[locations lastObject]).coordinate.longitude);NSLog(latitude  %f, ((CLLocation *)[locations lastObject]).coordinate.latitude);[manager stopUpdatingLocation]; }后面的处理和上面的方法一样大家可以看一下。另外还有一些CLGeocoder的属性如下property (nonatomic, readonly) NSDictionary *addressDictionary;// address dictionary properties property (nonatomic, readonly) NSString *name; // eg. Apple Inc. property (nonatomic, readonly) NSString *thoroughfare; // street address, eg. 1 Infinite Loop property (nonatomic, readonly) NSString *subThoroughfare; // eg. 1 property (nonatomic, readonly) NSString *locality; // city, eg. Cupertino property (nonatomic, readonly) NSString *subLocality; // neighborhood, common name, eg. Mission District property (nonatomic, readonly) NSString *administrativeArea; // state, eg. CA property (nonatomic, readonly) NSString *subAdministrativeArea; // county, eg. Santa Clara property (nonatomic, readonly) NSString *postalCode; // zip code, eg. 95014 property (nonatomic, readonly) NSString *ISOcountryCode; // eg. US property (nonatomic, readonly) NSString *country; // eg. United States property (nonatomic, readonly) NSString *inlandWater; // eg. Lake Tahoe property (nonatomic, readonly) NSString *ocean; // eg. Pacific Ocean property (nonatomic, readonly) NSArray *areasOfInterest; // eg. Golden Gate Park完整的工程如下附件下载地址https://github.com/winann/TestLocation.git 转载于:https://blog.51cto.com/winann/1532528
http://www.pierceye.com/news/552044/

相关文章:

  • 网站开发 发送邮件功能深圳做分销商城网站
  • 网站备案 取消网上智慧团建官网入口
  • 网站开发 无代码app 外包开发公司
  • 做网站应该用什么配置的手提电脑免费微商城小程序模板
  • 义乌外贸网站建设公司服务外包和劳务外包区别
  • 四川长昕建设工程有限公司网站兰州网站哪里做
  • 电子商务网站规划与管理申请一个域名后怎么做网站
  • 中小企业网站制作方法桂林景区网站策划
  • shopify做全品类网站提交链接
  • 网站建设和运营哪家公司好宠物医疗设计素材网站
  • 泰州网站制作公司中国空间站机械臂
  • 信誉好的常州网站建设网监备案网站更换域名
  • 淮南品牌网站建设电话南昌网站建设q479185700棒
  • 富阳区住房和城乡建设局网站广州市住房保障和房屋管理局
  • 江门建设局网站上海住房和城乡建设部网站
  • 开一个网站需要什么建设商务网站的方案
  • asp.net网站开发 pdf全球互联网中心在哪里
  • 做外贸网站要有域名学什么可以做网站
  • 服装高级定制品牌app排名优化
  • 济南推广网站建设保定seo网络推广
  • 网站运营策略wordpress调用友情链接
  • 网站流量下降原因京津冀协同发展四区指的是
  • 北滘网站设计网站建设应解决的问题
  • 网站建设空间申请wordpress 学校主题
  • 长沙市建设工程质量安全监督站官方网站做网站入门看什么书
  • 网站设计 素材代账行业门户网站开发
  • 旅游公司网站开发与实现如何建立公司网站
  • 专门做金融培训的网站有哪些wordpress注册没反应
  • 网站备案部门建设厅焊工证什么样子
  • 南宁市建设工程质量监督站网站设计模式