Tag: 注释

在一个长按快速的地图视图添加一个引脚注释

我正在试图制作一个iPhone应用程序,要求用户能够长时间按下地图视图上的某个地方以放置一个别针。 有人知道这是怎么做的? 当你长时间按下屏幕时,苹果地图上的行为是可观察的。 它会放下一个别针,并提出一个注释,说“掉销”

关于苹果的KMLViewer地标说明和注释字幕

在我的应用程序中,我使用Apple的KMLViewer来显示从KML文件获得的注释。在文件KMLParser.m中,有一个实例variablesplacemarkDescription,用于将描述标签下的信息从kml文件转换为注释字幕。现在,我的文件每个注释都有这样存储在Description下的信息: &lt;table width="280px"&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;table width="280px"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Fitness Bulls&lt;/b&gt;—Palester sportive. Sporti dhe koha e lire…..&lt;a href="http://www.site.com/BIZ_DIR/810180432/Article-Fitness-Bulls.aspx" style="color:Green;" &gt;Shikoni detajet &gt;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.site.com/HartaV2/AddReview.aspx?gisDataId=8123855e-b798-40bc-ad2e-00346a931211" style="color:Green;" &gt;Shkruani pershtypjen tuaj &gt;&gt; &lt;/a&gt; &lt;p style="float:right;"&gt;Postuar nga:&lt;i&gt;Import&lt;/i&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 在KMLParser.mi中,将placemarkDescription从这个转换为: <html><body> <table width="280px"><tr><td></td><td></td></tr></table><table width="280px"><tr><td> <b>Fitness Bulls</b>—Palester sportive. Sporti dhe koha e lire….. <a href="http://www.site.com/BIZ_DIR/810180432/Article-Fitness-Bulls.aspx" style="color:Green;" >Shikoni detajet >></a></td></tr><tr><td> <a href="http://www.site.com/HartaV2/AddReview.aspx?gisDataId=8123855e-b798-40bc-ad2e-00346a931211" style="color:Green;" >Shkruani pershtypjen tuaj >> </a> <p style="float:right;">Postuar […]

iOS区分哪个标注配件是轻拍的

在我的地图注释中,我有一个UIButton作为标注中的每个附件视图。 在- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control方法,我怎么知道哪个附件视图被处理过每个事件? 这是我的代码: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"]; UIButton *calloutButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; UIButton *directionsButton = [UIButton buttonWithType:UIButtonTypeCustom]; directionsButton.frame = CGRectMake(0, 0, 23, 23); [directionsButton setBackgroundImage:[UIImage imageNamed:@"directions.png"] forState:UIControlStateNormal]; MyPin.leftCalloutAccessoryView = directionsButton; MyPin.rightCalloutAccessoryView = calloutButton; MyPin.draggable = NO; MyPin.highlighted […]

在mapview上注释时,将数据传递给detailView

我有一个地图视图,有10个商店的位置,这些数据来自webservice。 我只是想推到我的详细信息视图,以显示被点击的商店的地址,电话和其他信息。 我需要传递数据到我的detailview当用户点击或触摸内部的mapkit注释。 在我的mapview有10个注释,首先我想知道,我怎么能理解,或者怎样才能得到注释被点击的annotationID? 这是我返回引脚的方法 – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; MKPinAnnotationView* pinView = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier]; pinView.animatesDrop=YES; pinView.canShowCallout=YES; pinView.pinColor=MKPinAnnotationColorPurple; UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; pinView.rightCalloutAccessoryView = rightButton; return pinView; } /* and my action method […]

iOS刷新mapview上的注释

我有一个mapview,其注释的坐标不断更新,但是当我使用setCoordinate时,注释不会移动。 如何刷新注释以反映其坐标? – (void)updateUnits { PFQuery *query = [PFQuery queryWithClassName:@"devices"]; [query whereKeyExists:@"location"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { for (PFObject *row in objects) { PFGeoPoint *geoPoint = [row objectForKey:@"location"]; CLLocationCoordinate2D coord = { geoPoint.latitude, geoPoint.longitude }; for (id<MKAnnotation> ann in mapView.annotations) { if ([ann.title isEqualToString:[row objectForKey:@"deviceid"]]) { [ann setCoordinate:coord]; NSLog(@"latitude is: %f" […]

使地图缩放到用户位置和注释(swift 2)

我正在使用mapkit。 我想让地图缩放以显示用户的位置和注释点,而不是缩放到用户的当前位置。 目前我有: let annotation = MKPointAnnotation() annotation.coordinate = CLLocationCoordinate2DMake(mapLat, mapLon) annotation.title = mapTitle self.map.addAnnotation(annotation) func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let userLoction: CLLocation = locations[0] let latitude = userLoction.coordinate.latitude let longitude = userLoction.coordinate.longitude let latDelta: CLLocationDegrees = 0.05 let lonDelta: CLLocationDegrees = 0.05 let span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta) let location: CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, […]

如何计算用户移动时从用户位置到注释的距离

我有一个用户位置(蓝点)和mapView注释。 当select注释时,我将文本设置为distLabel – “到点%4.0f m的距离”。 用户移动时如何更新该文本标签? didSelectAnnotationView: – (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { CLLocation *pinLocation = [[CLLocation alloc] initWithLatitude: [(MyAnnotation*)[view annotation] coordinate].latitude longitude: [(MyAnnotation*)[view annotation] coordinate].longitude]; CLLocation *userLocation = [[CLLocation alloc] initWithLatitude: self.mapView.userLocation.coordinate.latitude longitude: self.mapView.userLocation.coordinate.longitude]; CLLocationDistance distance = [pinLocation distanceFromLocation:userLocation]; [distLabel setText: [NSString stringWithFormat:@"Distance to point %4.0f m.", distance]]; } 我知道有一个函数didUpdateToLocation ,但我怎样才能用它didSelectAnnotationView ? – (void)locationManager:(CLLocationManager […]

删除MKMapView注释与一定的pinColor?

是否有可能删除给定pinColor给定MKMapView上的所有注释? 我试图清除我的地图上的所有用户input的注释(引脚)之前显示新的我的应用程序的一部分,但我不知道如何粒度我可以有select地删除注释… 我想只删除所有具有MKPinAnnotationColorGreen(绿色)引脚的注释,但是我也可以简单地删除用户input的所有引脚,如果有方法我可以跟踪这些。 我知道我可以简单地做: [myMapView removeAnnotations:myMapView.annotations]; …然后重新绘制所有我想要的注释,但这似乎是浪费资源。 有什么build议?

iOS – MKMapView – 可拖动注释

我已经准备好了注释,但是试图找出如何使用我的代码拖动它: -(IBAction) updateLocation:(id)sender{ MKCoordinateRegion newRegion; newRegion.center.latitude = mapView.userLocation.location.coordinate.latitude; newRegion.center.longitude = mapView.userLocation.location.coordinate.longitude; newRegion.span.latitudeDelta = 0.0004f; newRegion.span.longitudeDelta = 0.0004f; [mapView setRegion: newRegion animated: YES]; CLLocationCoordinate2D coordinate; coordinate.latitude = mapView.userLocation.location.coordinate.latitude; coordinate.longitude = mapView.userLocation.location.coordinate.longitude; MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init]; [annotation setCoordinate: coordinate]; [annotation setTitle: @"Your Car is parked here"]; [annotation setSubtitle: @"Come here for pepsi"]; [mapView addAnnotation: annotation]; […]

用不同的针脚颜色映射视图注释

我有一个超过200个对象的数组,我试图执行每个循环。 每个对象将有一个是/否的字段,我想显示一个不同的颜色标记依赖是/否的值。 从我所看到的是我的循环正在经历每个对象,然后在每个对象的末尾添加所有的注释。 由于我在循环中通过数组中的yes no值执行了一个检查,当所有的注释被添加到我的地图中时,它将使用来自数组中最后一个对象的yes / no值。 我怎么能这样做,这样标记将是不同的取决于每个元素的是/否值? 我的代码是 for (i = 0; i < [appDelegate.itemArray count]; i++) { item_details *tempObj = [appDelegate.itemArray objectAtIndex:i]; location.latitude = [tempObj.lat floatValue]; location.longitude = [tempObj.lon floatValue]; current_yesno = tempObj.yesno; MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc]initWithTitle:tempObj.name andCoordinate:location]; [self.mapView addAnnotation:newAnnotation]; [newAnnotation release]; } 我的注释代码如下 – (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ […]