
下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
.h IBOutlet GMSMapVIEw *_mapVIEw;注: _mapVIEw我这里使用了Storyboard,放地图放在VIEw里面 就是以下三部分。- (voID)initMapVIEw{ //创建地图 [_mapVIEw clear]; GMSCameraposition *camera = [GMSCameraposition cameraWithLatitude:-6.13631 longitude:106.789352 zoom:ZOOM_LEVEL]; _mapVIEw.mapType = kGMSTypenormal; _mapVIEw.camera = camera; _mapVIEw.delegate = self; _geocoder = [[GMSGeocoder alloc] init]; polyline = [[GMSpolyline alloc] init]; linepath = [GMSMutablePath path]; CLLocationCoordinate2D coords; coords.latitude = -6.136271; coords.longitude = 106.789216; _mapVIEw.camera = [GMSCameraposition cameraWithTarget:coords zoom:ZOOM_LEVEL]; //显示标注 GMSReverseGeocodeCallback handler = ^(GMSReverseGeocodeResponse *response,NSError *error) { if (response && response.firstResult) { GMSMarker *marker = [[GMSMarker alloc] init]; marker.position = coords; marker.Title = response.firstResult.addressline1; marker.snippet = response.firstResult.addressline2; _addressData = response.firstResult.addressline2; [self refreshGpsInfo]; marker.appearanimation = kGMSMarkerAnimationNone; marker.icon = SEtimage(@"deviceannotation.png"); marker.map = _mapVIEw; } else { NSLog(@"Could not reverse geocode point (%f,%f): %@",coords.latitude,coords.longitude,error); } }; [_geocoder reverseGeocodeCoordinate:coords completionHandler:handler]; //画线,轨迹回放 [linepath removeAllCoordinates]; [self drawlineWithLocationArray:trackArray]; /*注,trackArray里面的数据格式 CLLocation *NowLocation = [[CLLocation alloc] initWithLatitude:coords.latitude longitude:coords.longitude]; [trackArray addobject:NowLocation]; */ } //画线,使用轨迹回放 - (voID)drawlineWithLocationArray:(NSArray *)locationArray{ if(current_type == _CURRENT_TRACK) polyline.strokecolor = [UIcolor bluecolor]; else polyline.strokecolor = [UIcolor redcolor]; polyline.strokeWIDth = 6.f; // for(int IDx = 0; IDx < pointStrings.count; IDx++) for(int IDx = 0; IDx < locationArray.count; IDx++) { CLLocation *location = [locationArray objectAtIndex:IDx]; CLLocationdegrees latitude = location.coordinate.latitude; CLLocationdegrees longitude = location.coordinate.longitude; // create our coordinate and add it to the correct spot in the array CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude,longitude); [linepath addCoordinate:coordinate]; } polyline.path = linepath; polyline.map = _mapVIEw;} 以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的地图轨迹全部内容,希望文章能够帮你解决地图轨迹所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)