iOS在地图开发基础,有点乱,将就一下
来源:互联网 发布:Windows ftp 服务 编辑:程序博客网 时间:2024/05/01 10:10
定位和地图:定位:经纬度 获取现在位置的经纬度就是手机的定位zai info.plist 添加NSLocationAlwaysUsingsNSLocationAlwaysUsageDescriptionNSLocationAlwaysUsageDescriptionCLLocation *location=[locations firstObject];CLLocationCoordinate2D coordinate=location.coordinate; NSLog(@"%g %g",coordinate.latitude,coordinate.longitude);地理编码:--地名--获取经纬度地理反编码:经纬度--》地名@property (strong,nonatomic)CLGeocoder *gecoder;解码: [self.gecoder reverseGeocodeLocation:location completionHandler:^(NSArray * __nullable placemarks, NSError * __nullable error) { if (placemarks==nil || placemarks.count==0) { NSLog(@"can not find this place") ; } else { CLPlacemark *placemark=[placemarks firstObject]; NSLog(@"%@ %2f %2f %@ %@ %@",placemark.name,placemark.location.coordinate.latitude,placemark.location.coordinate.longitude,placemark.thoroughfare,placemark.subThoroughfare,placemark.subLocality); } }];编码: [self.gecoder geocodeAddressString:self.textPut.text completionHandler:^(NSArray * __nullable placemarks, NSError * __nullable error) { for (CLPlacemark *placeMark in placemarks) { NSLog(@"%.2f %.2f %@",placeMark.location.coordinate.latitude,placeMark.location.coordinate.longitude,placeMark.name); } }];定位:框架是:corelocation CLLocationManager 地理编码clgeocoder gecoder “,^—clplacemarkgeo geocodeAddressString:<#(nonnull NSString *)#> completionHandler:<#^(NSArray * __nullable placemarks, NSError * __nullable error)completionHandler#>CLLocation *location=[[CLLocation alloc] initWithLatitude:23 longitude:133];地图:mapkit.frameworkMKmapview自定义打头阵1.《MKannotation》location—2d title subtitle[self.map addannotation :SCHAnnotation]delegate;MKAnnotation —>MKPinAnnotationview(内容比较丰富)导航:mkmapitem MKMapItem openMapsWithItems:<#(nonnull NSArray *)#> launchOptions:<#(nullable NSDictionary *)#>地图上画线:MKdiretionsrequest source=placemark destinationmkdirection MKDirectionsRequest *mkRequest=[[MKDirectionsRequest alloc] init]; MKMapItem *sourceItem=[[MKMapItem alloc] initWithPlacemark:sourcePlace]; MKMapItem *destItem=[[MKMapItem alloc] initWithPlacemark:destPlaceMark]; mkRequest.destination=destItem; mkRequest.source=sourceItem; MKDirections *directions = [[MKDirections alloc]initWithRequest:mkRequest]; [directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse * __nullable response, NSError * __nullable error) { for (MKRoute *route in response.routes) { [self.map addOverlay:route.polyline]; } }];- (nonnull MKOverlayRenderer *)mapView:(nonnull MKMapView *)mapView rendererForOverlay:(nonnull id)overlay{ MKPolylineRenderer *line1=[[MKPolylineRenderer alloc]initWithOverlay:overlay]; line1.lineWidth=4; line1.strokeColor=[UIColor redColor]; // MKOverlayRenderer *lay=[[MKOverlayRenderer alloc] initWithOverlay:overlay]; return line1;}
0 0
- iOS在地图开发基础,有点乱,将就一下
- 有点乱!
- 有点乱
- 有点乱
- 有点乱~
- 有点乱
- 有点乱
- 有点乱
- 有点乱
- 有点乱
- 有点乱、有点烦
- 有点乱,有点迷茫
- js 开发笔记收集(有点乱,本人备忘而以)
- HR开发(个人总结 有点乱哦)
- ebay的api的开发技术笔记,有点乱
- iOS 在xcode6 百度地图开发 注意事项
- 今天有点乱
- 有点乱的心
- SE总结
- 海思HI35XX之----视频处理单元各通道间的关系
- [数学小考] 2015.6.24
- 3com 4210配置记录
- android 配置文件中配置service
- iOS在地图开发基础,有点乱,将就一下
- Android之开机自启动Service
- shell脚本中的数学运算
- properties的配置文件缓存模型
- ubuntu下使用curl查询本机公网ip
- leetcode 27 Remove Element
- iOS中Bonjour:NSNetServiceBrowser在子线程上使用
- 对activity的四种启动模式的理解
- dcmtk在PACS开发中的应用(基础篇) 作者:冷家锋 第三章 工作列表(Work List)(一)