Tag: mkannotation

如何find符合我的标准的地图注释

我有一个MapView的用户位置,和一堆地图注释。 起初我想在地图上显示所有可能的引脚。 (成功做到这一点) 然后,我想放大地图以仅显示距离userLocation注释50公里内的注释 我如何find这些注释?

在拖动过程中查看MKAnnotation坐标

我希望能够跟踪我的MKAnnotation的坐标,当我拖动它。 目前,我只是获取拖动开始时的坐标。 我已经尝试与touchesMoved实现自定义的MKAnnotationView子类,但是这似乎不工作。 (如下所示: 拖动时获取MKAnnotation的坐标 。) 通过拖动我的注释接收新的坐标,我将依次能够更新我的多边形形状。 任何帮助实现这一点将不胜感激,谢谢。

为什么我的注释没有出现在我的地图视图中?

我创build了一套“IssueLocation”,这是一个符合MKAnnotation协议的类。 为什么我的注释(从API JSON数据构build)没有出现在我的地图视图中? 这里是所有背后的代码: class级代码: class IssueLocation: NSObject, MKAnnotation { var locationName: String var campusName: String var latitude: Double var longitude: Double var coordinate: CLLocationCoordinate2D init(locationName: String, campusName: String, latitude: Double, longitude: Double, coordinate: CLLocationCoordinate2D) { self.locationName = locationName self.campusName = campusName self.latitude = latitude self.longitude = longitude self.coordinate = coordinate super.init() } var subtitle: […]

从MKMapView删除最后添加的注释

有没有办法删除最后添加的注释?

iOS在mapkit中引脚颜色问题

我想要两种颜色的注释。 为此,我使用了以下代码, – (MKAnnotationView *)mapView:(MKMapView *)sender viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"MyLocation"; if ([annotation isKindOfClass:[PlaceMark class]]) { MKPinAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; annotationView.enabled = YES; annotationView.canShowCallout = YES; @try { if (annotationView == nil) { annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; } else { annotationView.annotation = annotation; if([[nsCenterOrOffice objectAtIndex:z] isEqualToString:@"C"]) { […]

标注放大iOS7后打开错误的视图

在我的应用程序中一切正常,除了一件事:放大和缩小后,看到整个地图,一些标注打开错误的detailview。 我不知道如果我错过了一些代码或其他。 使用Xcode 5.1.1 for iOS7。 这是我目前所掌握的: Annotation.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface Annotation: NSObject <MKAnnotation> @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *subtitle; @end Annotation.m #import "Annotation.h" @implementation Annotation @synthesize coordinate,title,subtitle; @end MapView.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface Nameofthemap : UIViewController <MKMapViewDelegate> @property (strong, nonatomic) IBOutlet MKMapView […]

Swift无法在MKAnnotation中分配字幕

我试图以编程方式更新MKAnnotation内的字幕。 以下代码行产生一个cannot assign subtitle in annotation错误中cannot assign subtitle in annotation : let annotation: MKAnnotation = mapView.annotations[0] as! MKAnnotation annotation.subtitle = nil 任何人都可以帮助我带领我在地图内显示MKAnnotation之后更新字幕的方向吗?

我的注释不显示PIN中的小标题

在显示PINS的实现类中,我已经预留了两个variables(标题和子标题),在这个例子中,当我点击PIN时,只显示单词USA (标题)。 CLLocationCoordinate2D location2D = (CLLocationCoordinate2D){ .latitude = latitudeOfUserLocation, .longitude = longitudeOfUserLocation }; ManageAnnotations *annotation=[[ManageAnnotations alloc]initWithTitle:@"USA" adresseDuTheme:@"Colorado" coordinate:location2D];//only USA is displayed annotation.pinColor = MKPinAnnotationColorRed; //or red or whatever [self->mapView addAnnotation:annotation]; MKCoordinateSpan span={.latitudeDelta=1,.longitudeDelta=0.5}; MKCoordinateRegion region={location2D,span}; [mapView setRegion:region]; 虽然在ManageAnnotations类中,我已经为标题和副标题保留了两个variables。 @interface ManageAnnotations : NSObject<MKAnnotation>{ NSString *_libelle; NSString *_adresse; CLLocationCoordinate2D _coordinate; } // @property(nonatomic,assign)MKPinAnnotationColor pinColor; @property(copy)NSString *libelle; @property(copy)NSString *adresse; […]

用UIAlertViewStylePlainTextInput编辑注释文本

我可以将引脚标注放到具有泄露button的地图上。 当单击该button时,会popup一个alertView,在其中可以删除选定的注释。 我现在正在尝试使用UIAlertViewStylePlainTextInput编辑选定的注释字幕。 任何想法如何我可以做到这一点? – (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { NSLog(@"Annotation button clicked"); UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Annotation" message:@"Edit Subtitle" delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:@"Update Subtitle", @"Remove Pin",nil]; alert.alertViewStyle = UIAlertViewStylePlainTextInput; [alert show]; } – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { NSLog(@"Hide button clicked"); } if (buttonIndex == 1) { NSLog(@"Update […]

自定义注释与相同的图像

正如您在下面的图片中看到的,所有注释具有相同的image和discount ,这是不正确的,他们应该有不同的image和discount 。 我怎样才能解决这个问题? 我正在使用一个自定义注释类与discountStr和'imgPathStr'属性和下面的代码。 -(void) connectionDidFinishLoading: (NSURLConnection *) connection { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; _adResultDict = [NSJSONSerialization JSONObjectWithData:_adResultData options:kNilOptions error:nil]; NSMutableArray *annoArray = [[NSMutableArray alloc]init]; NSArray *adArray = [[_adResultDict objectForKey:@"result"]objectForKey:@"ads"]; for (int i = 0; i<adArray.count;i++ ) { NSString *latLongStr = [[adArray objectAtIndex:i]objectForKey:@"area_lat_long"]; NSArray *tempLatLongArray =[ latLongStr componentsSeparatedByString:@","]; CLLocationCoordinate2D adPlace; adPlace.latitude = [[tempLatLongArray objectAtIndex:0] […]